{"id":29216932,"url":"https://github.com/nikhilbadyaldevelops/learn-docker","last_synced_at":"2026-04-29T22:39:22.942Z","repository":{"id":38382383,"uuid":"448797316","full_name":"nikhilbadyaldevelops/learn-docker","owner":"nikhilbadyaldevelops","description":"What I know about  Docker.","archived":false,"fork":false,"pushed_at":"2023-02-15T18:37:41.000Z","size":2636,"stargazers_count":0,"open_issues_count":8,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-08T10:44:55.757Z","etag":null,"topics":["docker","docker-compose","docker-image","dockerfile"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/nikhilbadyaldevelops.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}},"created_at":"2022-01-17T07:41:49.000Z","updated_at":"2023-09-02T13:29:57.000Z","dependencies_parsed_at":"2023-09-03T18:13:22.189Z","dependency_job_id":null,"html_url":"https://github.com/nikhilbadyaldevelops/learn-docker","commit_stats":null,"previous_names":["nikhilbadyaldevelops/learn-docker"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nikhilbadyaldevelops/learn-docker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikhilbadyaldevelops%2Flearn-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikhilbadyaldevelops%2Flearn-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikhilbadyaldevelops%2Flearn-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikhilbadyaldevelops%2Flearn-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nikhilbadyaldevelops","download_url":"https://codeload.github.com/nikhilbadyaldevelops/learn-docker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikhilbadyaldevelops%2Flearn-docker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32447292,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"ssl_error","status_checked_at":"2026-04-29T22:10:49.234Z","response_time":110,"last_error":"SSL_read: 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-compose","docker-image","dockerfile"],"created_at":"2025-07-03T01:38:59.249Z","updated_at":"2026-04-29T22:39:22.925Z","avatar_url":"https://github.com/nikhilbadyaldevelops.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker Commands\n\n## Conainers\n\n1. `docker --help` - To get help for commands.\n1. `docker \u003ccommand\u003e --help` - To get help for a particular command.\n1. `docker ps -a` - lists all running ports. `-a` shows all containers without that it shows only running.\n1. `docker stop \u003ccontainer-name` - Stops the container mentioned\n1. `docker run --network \u003cnetworkName\u003e --env/-e \u003cenvVariables\u003e --env-file \u003cfileLocation\u003e --rm -p \u003cp1:p2\u003e --name \u003cSomeName\u003e -it -d -v \u003cpathInHost:pathInContainer\u003e \u003cimage-name:tag\u003e` - create container from image and run. if not available then download from docker hub. `-it` flags tells us to expose interactive terminal from container to our local machine. By default, it runs in attach mode.`-d` to run the container in detach mode.`--rm` flag tells to remove the container when it stops and anonymous volumes are also removed.`--name` to give custom name to the container.`-p` flags is to `publish`, under which port on our local machine the docker port should be accessible. `p1` is the local port and `p2` is container port.`-v` to add volumes.I can add `-v` two times to add bind mount.`--env` to set envioronment variables.\n1. `docker build -t \u003cname:tag\u003e --build-args \u003cARGNAME\u003e \u003cdir\u003e` - Build an image from Dockerfile.`-t` to give custom tag to the\n   image. `\u003cname:tag\u003e` specifies the format of the tag.\n1. `docker start -a -i \u003ccontainerID/containerName\u003e` - To start an existing container. By default, it starts in detach\n   mode.`-a` to start container in attach mode.`-i` for interactive shell.\n1. `docker logs -f \u003ccontainerName/ID\u003e` - To print the past logs in console.`-f` to tell docker that we want to follow\n   the future logs.(Kind of attach state)\n1. `docker attach \u003ccontainerName\u003e` - Attach to a running container.\n1. `docker rm \u003ccontainerName/s\u003e` - Remove container. Cannot remove running container.Can write multiple names separated\n   by space.\n1. `docker container prune` - delete a stopped containers.\n1. `docker images` - to list all images.\n1. `docker rmi \u003cimageName/s:tagName\u003e` - to remove **`images`**. Only images which are not used.Mention tag if exist.\n1. `docker image prune -a inspect` - `prune` remove all images.`inspect` used to inspect the image.`-a` tag to prune\n   images incl. tagged images.\n1. `docker cp \u003csrc\u003e \u003ccontainerName:dest\u003e` - to copy in/out to/from the container.`dest` will be created if it doesn't\n   exist.\n1. `docker push \u003chostName\u003e:tagname` - It pushed the image to the host mentioned.\n1. `docker pull \u003cimage:tagName` - To pull image from docker\n1. `docker tag \u003coldName\u003e \u003cnewName\u003e` - To rename a image.\n1. `docker login` - To loign to docker hub\n1. `docker logout` - to logout from docker hub.\n1. `host.docker.internal`- to get access to local host\n1. `docker exec \u003ccontainer\u003e \u003ccommand\u003e`- to run command inside container.\n\n## Volumes(Anonymous Volumes, Named Volumes, Bind Mounts)\n\n1. `docker volume rm \u003cvolumneName\u003e prune ls inspect \u003cvolumeName\u003e create \u003cvolumeName\u003e` - `create` to create volume manually.`ls` to list all volumes.`inspect` to see details of a volume.`prune` to remove all unused **local** volumes.`rm` remove volume by name.\n   1. -v \"%cd%:/app\" in windows ( For Bind mounds)\n   1. -v ${pwd}:app in mac/linux\n1. `docker run -v /app/data` - Anonymous Voumes.Survives shutdown/stopping of containers but not removal. Can't be shared by container. Created by `--v` flag or by writting docker file.\n1. `docker run -v data:/app/data` - Named Volumes. Created by `--v` flages. In general and not linked to particular container. also survive removals. Can be shared across containers.\n1. `docker run -v /path/to/code:/app/code` - Bind Mount. Not tied to particular container. Can be shared across containers. survives restart and removal.`ro` can be added to tell docker that its a read only volume.\n\n## Network\n\n1. `docker network create` - `create` to create a network\n\n## Docker Compose\n\n`exec`\n`run`\n`up`\n`down` # environment: # - MONGO_INITDB_ROOT_PASSWORD: nikhil # - MONGO_INITDB_ROOT_USERNAME: nikhil # build: # context: ./backend # dockerfile: Dockerfile\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikhilbadyaldevelops%2Flearn-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnikhilbadyaldevelops%2Flearn-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikhilbadyaldevelops%2Flearn-docker/lists"}