docker useful commands

docker build . -t mynewimage

docker run -d -t --name letsrock imagename

docker exec -it letsrock bash1

docker images

docker ps

docker-compose up -d

docker system prune -a

To delete all volumes using the following command: docker volume rm $(docker volume ls -q)

View logs docker logs imagename -f

Create external network for traefik docker network create --driver=bridge --attachable --internal=false traefik_proxy Output: 7aa05528d00064911164455c18d06a920885c1011fb1e9183d6f4ef437aae31f

docker stats

  1. Some containers may not have bash installed. To add it add the following line to the Dockerfile RUN apk update && apk add bash. You can also just run from the command line docker exec -it mycontainer apk update and docker exec -it mycontainer apk add bash