docker ps
Give me a list of all containers and their status.
docker inspect CONTAINER
Give me information about a container (you can find ip address and other info).
This runs an image and will download if you don't already have it.
docker run REPONAME:latest
If you want to run an image but you don't want to keep it.
docker run --rm REPONAME:latest
docker pull IMAGE_NAME
or docker pull USERNAME/IMAGE_NAME
For private images, you need the full path docker pull URL
docker rm $(docker ps -a -q)
docker rmi IMAGE ID
Can also just type the first 4 characters of the IMAGE ID
Dockerhub has you run this command
$ docker run -it --rm --user "$(id -u):$(id -g)" -v "$PWD":/usr/src/app -w /usr/src/app rails rails new --skip-bundle NAME
BUT if you are on Mac OS X, using Docker Toolbox, you need to remove the --user "$(id -u):$(id -g)"
if you get an error. So, use this instead: docker run -it --rm -v "$PWD":/usr/src/app -w /usr/src/app rails rails new --skip-bundle NAME
(Deprecated if you're using Docker native.)
docker-machine ls
lists all machines running
docker-machine rm [NAME]
removes the machine named
docker-machine create [OPTIONS]
will create a new machine
docker-compose build
will build your project if this is your first time getting it setup. If you make changes to your Dockerfile, you will need to re-run docker-compose build
.
docker-compose up
will download images and setup containers as specified in docker-compose.yml. This will also link containers that need to be linked. You can run this in the background by using the -d
tag (i.e. detached).
docker-compose down
will remove any images and containers in the project.
--remove-orphans
use this flag to remove any orphan containers when composing up or down.