An open API service indexing awesome lists of open source software.

https://github.com/husna-poyraz/docker-commands

This repository was created to explain the most commonly used docker commands.
https://github.com/husna-poyraz/docker-commands

docker docker-commands docker-container docker-image docker-registry

Last synced: 4 months ago
JSON representation

This repository was created to explain the most commonly used docker commands.

Awesome Lists containing this project

README

        

# Docker Commands



| Commands | Description | Example |
| --------------------------------------------| --------------------------------------------------|-------------------------------------------------------|
| `docker version` | Show the Docker version information
| `docker pull ` | Pull an image or a repository from a registry | `docker pull ubuntu`
| `docker run ` | Run a command in a new container | `docker run ubuntu`
| `docker run :` | Run a command in a new container with the specified version | `docker run ubuntu:20.04`
| `docker run -p : `| Publish a container's port(s) to the host | `docker run -p 8080:80 webApp`
| `docker run --detach ` or `docker run -d `| Run container in background and print container ID | `docker run -d redis`
| `docker --attach ` or `docker -a ` | Attach to STDIN, STDOUT or STDERR | `docker --attach 9cd`
| `docker container logs ` | Fetch the logs of a container | `docker container logs 9cd`
| `docker run sleep ` | Run a command in a new container until the wait time | `docker run ubuntu sleep 10`
| `docker run -it ` | Run command in a new container and get inside that container| `docker run -it ubuntu`
| `docker run --name -it ` | Start one or more stopped containers with container name | `docker start bash_ubuntu`
| `docker stop ` or `docker stop ` | Stop one or more stopped containers with container name/id | `docker stop bash_ubuntu`
| `docker rm `or `docker rm ` | Remove one or more containers with container name/id | `docker rm bash_ubuntu`
| `docker container rm $(docker container ls -aq)` | Remove all running or not running containers
| `docker ps` or `docker container ls` | List only shows running containers by default
| `docker ps -a`, `docker ps --all` or `docker container ls -a`| List all running or not running containers
| `docker images` | List the most recently created images
| `docker rmi ` or `docker rmi `| Remove the docker image | `docker rmi ubuntu`
| `docker image tag ` | Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE | `docker image tag ubuntu my-ubuntu`
| `exit` | Exit docker container |