This page contains information about Docker that is useful for installation, administration, and development.
Docker Engine and Docker Compose
On OS X:
- Install the Docker for Mac.
- If you are using Docker Toolbox, switch to Docker for Mac.
- 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. Add
-fto follow the logs.
docker logs <container name>
- List the log from a single container. Add
-fto follow the logs.
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¶
Most harvesters and exporters handle one request at a time; requests for exports and harvests queue up waiting to be handled. If requests are taking too long to be processed you can scale up (i.e., create additional instances of) the appropriate harvester or exporter.
To create multiple instances of a service, use docker-compose scale.
The harvester most likely to need scaling is the Twitter REST harvester since some harvests (e.g., broad Twitter searches) may take a long time. To scale up the Twitter REST harvester to 3 instances use:
docker-compose scale twitterrestharvester=3
To spread containers across multiple containers, use Docker Swarm.
Using compose in production provides some additional guidance.