Run a new container
docker run <container id or name>
Start a stopped container
docker start <container id or name>
Stop a container
docker stop <container id or name>
Kill a container
docker kill <container id or name>
Restart a container
docker restart <container id or name>
List all running containers
docker ps
List all containers
docker ps -a
List with formatted output (here only show name and status of containers)
docker ps --format '{{.Names}} {{.Status}}'
Inspect a container
docker inspect <container id or name>
List all ports a container uses
docker container port <container id or name>
Open Bash in container (‘exit’ to close)
docker exec -it <container id or name> bash
Watch STDOUT from container (‘-f’ for continued logging)
docker logs <container id or name>
Search containers in registry (example: “MySQL” gives all available MYSQL-containers)
docker search <search word>
Pull container from registry
docker pull <name>
0 Comments.