Essentials commands Flashcards
List containers
docker container ls
List images running
docker image ls
Pull an image
docker image pull
docker image pull nginx
Return low level details from image
docker image inspect
List all commands pertain to container
docker container -h
Run busybox container
docker container run busybox
docker container run -d –name nginx –restart unless-stopped -p 8080:80 –memory 500M –memory-reservation 256M nginx
List all containers
List currently running containers
docker container ls -a
docker container ls
List container’s logs
docker container logs
List statistic for a container
docker container stats
Execute a command on a running container
docker container exec -it /bin/bash
after that you get into the shell of the container,
now you can run ls etc
exit command will not stop the container
or simply run:
docker container exec -it ls -al /usr/share/nginx/html/ to list html dir
Pause/unpause container
docker container pause
docker container unpause
Erase either stopped or running container
docker container rm -f
Remove all stopped containers
docker container prune
Run a container and makes this deleted after exiting
docker container run –rm busybox