- don't run docker commands as root
sudo usermod -aG docker callimachus
- Docker Hub
- Docker Compose
docker info
docker inspect
docker exec -it
docker run -d
docker ps -a
docker stop [my_container]
docker rm [my_container]
docker rmi [docker_image]
docker volume rm [my_volume]
docker volume create [my_volume]
docker volume ls
docker volume inspect [my_volume]
docker container ls -aq # list all containers
nginx # default to latest
nginx:latest # specifically use tag latest
centos:centos6 # pull centos 6 base image
docker run -d --name=nginx nginx:latest
docker restart nginx
# Interactive, attach with a shell.
docker exec -it nginx /bin/bash
docker ps # Running Processes
docker ps -a # Running and Stopped Processes
docker rmi centos:centos6
docker image prune # remove all currently unused imaged docker image prune -a # clear everything
docker rm nginx:old
docker system prune # remove all stopped containers, images, unused networks
docker container stop
docker inspect
docker inspect nginx:latest | grep IPAddr
docker volume ls
docker volume rm
docker volume prune
In docker-compose
expose
-> reveal ports to the docker environment
ports
-> expose ports to docker and to the host system (i.e. publish the ports)
# docker run -d -p HOSTPORT:CONTAINERPORT
docker run -d -p 8080:80 --name=WebServer nginx:latest
# docker run -d -p 8080:80 --name=webserver -v HOSTVOLPATH:CONTAINERVOLPATH nginx:latest
docker run -d -p 8080:80 --name=webserver -v /home/user/www:/usr/share/nginx/html nginx:latest
# Execute in directory with dockerfile, or define path
docker build -t dzoladz/ubuntu .
- each step in the build process is a new container
- try to combine mulitple RUN commands when possible
RUN * applies to the base images
CMD * applies to the container instantiated on the base image
EXPOSE * expose container ports to host system
docker build -t keycloak-proxy .
docker run -d -p 80:80 -p 443:443 --name=keycloak-proxy keycloak-proxy:latest
# Reload Nginx config in running container
docker exec <container name> nginx -s reload
# NOTE: this will run Metabase without any persistent storage for the application.
docker run -d -p 3000:3000 --name metabase metabase/metabase
docker run -d -p 8080:80 --name owncloud --mount source=/Users/Derek/docker/owncloud,target=/var/www/html owncloud:8.1
docker network ls # list them all docker network prune -a # get rid of them all