Lifecycle Commands
- Create a container (without starting it):
- Rename an existing container
docker rename [CONTAINER_NAME] [NEW_CONTAINER_NAME]
- Run a command in a new container
docker run [IMAGE] [COMMAND]
- Remove container after it exits
- Start a container and keep it running
- Start a container and creates an interactive bash shell in the container
- Create, Start, and run a command inside the container and remove the container after executing command.
docker run -it-rm [IMAGE]
- Execute command inside already running container.
docker exec -it [container]
- Delete a container (if it is not running)
- Update the configuration of the container
docker update [CONTAINER]
Starting and Stopping Containers
- Stop running Container and start it again
docker restart [CONTAINER]
- Pause processes in a running container
- Unpause processes in a running container
docker unpause [CONTAINER]
- Block a container until others stop
- Kill a container by sending a SIGKILL to a running container
- Attach local standard input, output, and error streams to a running container
docker attach [CONTAINER]
Docker Image Commands
- Create an image from a Dockerfile
- Create an image from a Dockerfile with Tags
docker build -t <tag> [URL/FILE]
- Pull an image from a registry
- Push an image to a registry
- Create an image from a tarball
- Create an image from a container
docker commit [CONTAINER] [NEW_IMAGE_NAME]
- Load an image from a tar archive or stdin
docker load [TAR_FILE/STDIN_FILE]
- Save an image to a tar archive
docker save [IMAGE] > [TAR_FILE]
Docker Container And Image Information
- Lists both running containers and ones that have stopped
- List the logs from a running container
- List low-level information on Docker objects
docker inspect [OBJECT_NAME/ID]
- List real-time events from a container
docker events [CONTAINER]
- Show port mapping for a container
- Show running processes in a container
- Show live resource usage statistics of container
- Show changes to files (or directories) on a filesystem
- List all images that are locally stored with the docker engine
- Show the history of an image
Network Commands
- Remove one or more networks
docker network rm [NETWORK]
- Show information on one or more networks
docker network inspect [NETWORK]
- Connects a container to a network
docker network connect [NETWORK] [CONTAINER]
- Disconnect a container from a network
docker network disconnect [NETWORK] [CONTAINER]
Thank you for reading
I m missing 'docker exec -it [container] ' to execute a command inside the already running container.