10 Docker commands I use the most
List of 10 very common commands to manage docker
Docker is a very powerful tool to deploy easily some containers. Even though you can manage it via some web interfaces like Portainer, komodo or Dockhand (the one i use currently), you still have to know at least the basics to use it with commands.
This is why i put 10 of my most frequently used command to manage Docker.
Commands
Container management
- List all container running on the machine:
docker ps
- Execute a command inside a container:
docker exec <container name> <command>
- Follow logs from a container:
docker logs -f <container name>
Image management
- Pull an image from a docker repository:
docker pull <image url:latest|version>
- Lists all the docker images currently on the machine:
docker image list
- Remove a specific image:
docker image rm <image id>
- Remove all dangling images (not used by a running container):
docker image prune
- Load an image from a tar file
docker load <path/to/tar>
Docker compose
- Deploy the entire stack inside a docker compose file:
docker compose up -d
the flag '-d' is for "detach", useful run the container in the background.
- Remove all services inside a docker compose:
docker compose down