{"id":18965717,"url":"https://github.com/shahincsejnu/docker-stuff","last_synced_at":"2026-04-21T16:35:12.384Z","repository":{"id":144535139,"uuid":"325014844","full_name":"shahincsejnu/docker-stuff","owner":"shahincsejnu","description":"Most useful and necessary Docker commands.","archived":false,"fork":false,"pushed_at":"2021-01-04T10:37:31.000Z","size":7,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-24T06:42:45.542Z","etag":null,"topics":["docker","docker-image"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shahincsejnu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-28T13:04:11.000Z","updated_at":"2024-10-29T00:49:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"5827ac15-c6f1-4417-8b8a-d177dccdb832","html_url":"https://github.com/shahincsejnu/docker-stuff","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shahincsejnu/docker-stuff","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahincsejnu%2Fdocker-stuff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahincsejnu%2Fdocker-stuff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahincsejnu%2Fdocker-stuff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahincsejnu%2Fdocker-stuff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shahincsejnu","download_url":"https://codeload.github.com/shahincsejnu/docker-stuff/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahincsejnu%2Fdocker-stuff/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32100375,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T11:25:29.218Z","status":"ssl_error","status_checked_at":"2026-04-21T11:25:28.499Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-image"],"created_at":"2024-11-08T14:31:13.306Z","updated_at":"2026-04-21T16:35:12.323Z","avatar_url":"https://github.com/shahincsejnu.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# docker-stuff\n\n## Uninstall Old versions from your machine\n\n`sudo apt-get remove docker docker-engine docker.io containerd runc`\n\n## Install Using Repository\n\n### SET UP THE REPOSITORY\n\n- `sudo apt-get update`\n- `sudo apt-get install \\\n    apt-transport-https \\\n    ca-certificates \\\n    curl \\\n    gnupg-agent \\\n    software-properties-common`\n    \n- `curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -`\n- `sudo apt-key fingerprint 0EBFCD88`\n- `sudo add-apt-repository \\\n   \"deb [arch=amd64] https://download.docker.com/linux/ubuntu \\\n   $(lsb_release -cs) \\\n   stable\"`\n   \n### INSTALL DOCKER ENGINE\n\n- `sudo apt-get update`\n- `sudo apt-get install docker-ce docker-ce-cli containerd.io`\n\n\n## Manage Docker as a non-root user (use docker without sudo)\n\n- `sudo groupadd docker`\n- `sudo usermod -aG docker $USER`\n- log out and log back\n- `newgrp docker`\n\n\n## upload the docker image to [Docker Hub](https://hub.docker.com/)\n\n### First way\n\n- `docker login --username=\u003cdocker_hub_username\u003e`\n- `docker tag \u003cid_of_the_created_image\u003e \u003cdocker_hub_username\u003e/\u003cname_of_the_image\u003e:\u003ctag\u003e`\n- `docker push \u003cdocker_hub_username\u003e/\u003cname_of_the_image\u003e:\u003ctag\u003e`\n\n### Second way\n\n#### During docker image build use this\n\n- `docker build -t \u003cdocker_hub_username\u003e/\u003cimage_name\u003e:\u003ctag\u003e .`\n\n#### then for uploading in docker hub\n\n- `docker login --username=\u003cdocker_hub_username\u003e`\n- `docker push \u003cimage_repository_name\u003e:\u003ctag\u003e`\n\n\n## docker essential commands\n\n|Commands|Uses|\n|----|----|\n|`ps aux` | To see which processes are currently running in your machine|\n|`ip addr show` | To see the ethernet card in your machine including virtual ethernet card|\n|`users`  or `sudo users` | To see the users, user id of the root user is 0|\n|`id -u` | To get user id|\n|`id -g` | To get group id|\n|`docker ps`| To see all the containers running in your machine |\n|`docker ps -a` | To see the all available docker container in your machine(running and not running) with their details|\n|`docker images`| To see the all the images available in your machine|\n|`docker stop container_id`| To stop running container |\n|`docker stop $(docker ps -a -q)`| To stop all running containers|\n|`docker rm container_id` | To remove/delete a docker container(only if stopped) |\n|`docker rm $(docker ps -a -q)`| To delete all containers (only if stopped)|\n|`docker logs container_id`| To display logs of a container|\n|`docker inspect container_id` | To see full information about the container, will return json file|\n|`docker exec -it container_id sh`| To enter a container whose id is container_id in shell|\n|`docker exec -it container_id bash`| To enter a container whose id is container_id in bash|\n|`exit` | To exit from a docker container|\n|`ps` | To see the processes that are running inside a docker container|\n|`ls -l`| |\n|`hostname`| To see the hostname/container_id|\n|`route -n`| Can see the routing table of the container|\n|`docker build -t \u003cgive_an_image_name\u003e .`| To build the docker image from the Dockerfile, by doing this the tag will be latest of the image|\n|`docker image ls`| To see the list of all the available images with their tag, image id, creation time and size|\n|`docker run -d -p 8080:8080 image_name`| To run the docker image with the port mapping and in detached mode|\n|`docker run -p 8080:8080 image_name`| |\n|`docker run -p 8081:8088 \u003cimage_name\u003e start -p \"8088\"`| To set container port at 8088 and map pc port 8081 to container port 8088 |\n|`delete rm container_id`| To delete a specific container with id container_id|\n|`delete rmi image_id`| To delete a specific image|\n|`delete rmi -f image_id`| To delete a docker image forcefully|\n|`docker rm -f (docker ps -a `\u0026#124;` awk '{print$1}')` | To delete all the docker container available in your machine|\n|`docker rmi -f (docker images `\u0026#124;` grep none `\u0026#124;` awk '{print $3}')` | To delete all the docker images named none available in your machine|\n|`docker build -t docker_hub_username/image_name:tag_name .` | Tell the docker daemon to fetch the docker file present in the current directory(that's what the . does), then to build the image and give it a specified tag, by doing this don't need to tag before pushing docker hub|\n|`docker tag source_image[:tag] target_image[:tag]` | This command just creates an alias (a reference) by the name of the TARGET_IMAGE that refers to the SOURCE_IMAGE. That’s all it does. It’s like assigning an existing image another name to refer to it. Notice how the tag is specified as optional here as well, by the [:TAG]|\n|`docker rmi -f $(docker images -a -q)` | To delete all the images, but before this you should remove all the containers which are created from this images|\n|`docker rm -vf $(docker ps -a -q)` | To delete all containers including its volumes usee|\n|`docker container prune` | |\n|`docker image rm \u003cimage_name\u003e` | To delete a specific image|\n|`docker run -v \u003cabsolute_host_path/.env\u003e:\u003ccontainer_path/.env\u003e -p 8088:8089 \u003cimage_name\u003e start -p 8089`| To run the docker image where did not provide the .env file using docker mounting volumes on host|\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshahincsejnu%2Fdocker-stuff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshahincsejnu%2Fdocker-stuff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshahincsejnu%2Fdocker-stuff/lists"}