This page contains information about Docker that is useful for installation, administration, and development.
On OS X:
- Install the Docker Toolbox.
- Be aware that Docker is not running natively on OS X, but rather in a VirtualBox VM.
- If you have difficulties with the
aptinstall, try the
- The docker group is automatically created. Adding your user to the docker
avoids having to use sudo to run docker commands. Note that depending on how
users/groups are set up, you may need to manually need to add your user to the
docker-compose up -d
- Bring up all of the containers specified in the docker-compose.yml file. If a container has not yet been pulled, it will be pulled. If a container has not yet been built it will be built. If a container has been stopped (“killed”) it will be re-started. Otherwise, a new container will be created and started (“run”).
- Pull the latest images for all of the containers specified in the docker-compose.yml file with the image field.
- Build images for all of the containers specified in the docker-compose.yml file with the build field. Add
--no-cacheto re-build the entire image (which you might want to do if the image isn’t building as expected).
- List running containers. Add
-ato also list stopped containers.
- Stop all containers.
docker kill <container name>
- Stop a single container.
docker-compose rm -v --force
- Delete the containers and volumes.
docker rm -v <container name>
- Delete a single container and volume.
docker rm $(docker ps -a -q) -v
- Delete all containers.
- List the logs from all containers.
docker logs <container name>
- List the log from a single container.
docker-compose -f <docker-compose.yml filename> <command>
- Use a different docker-compose.yml file instead of the default.
docker exec -it <container name> /bin/bash
- Shell into a container.
docker rmi <image name>
- Delete an image.
docker rmi $(docker images -q)
- Delete all images
docker-compose scale <service name>=<number of instances>
- Create multiple instances of a service.
Scaling up with Docker¶
To create multiple instances of a service, use docker-compose scale. This can be used to created multiple instances of a harvester when the queue for that harvester is too long.
To spread containers across multiple containers, use Docker Swarm.
Using compose in production provides some additional guidance.