-
Notifications
You must be signed in to change notification settings - Fork 14
Docker Command Reference
Below are some basic Docker commands. More complete information is available on the Docker website.
Create and run the required services in containers:
docker compose up
Stop and remove containers and networks:
docker compose down
Restart a service:
docker compose restart mysql
Restart all services:
docker compose restart
View stats on running containers:
docker stats
List containers:
docker compose ps
List images:
docker image ls
List networks:
docker network ls
View Docker disk usage:
docker system df --verbose
Execute a command in a running container:
docker compose exec elasticsearch7 ...
Fire up a bash shell within a container:
docker compose exec elasticsearch7 bash
Remove stopped containers, dangling images, unused networks, etc.
docker system prune
Certain features require an active trial license, which is valid for 30 days. If your license expires, you will need to rebuild your local cluster:
-
Shut everything down:
docker compose down (or Ctrl-C)
-
Force-remove the relevant Elasticsearch container & volume:
docker compose rm -f elasticsearch7 ; docker volume rm search-services_es_7_data
-
Start everything up again:
docker compose up
-
Verify that a new license has been applied:
curl localhost:9200/_license
{
"license" : {
"status" : "active",
"type" : "trial",
...
}
}
(NB: The Kibana web interface of the locally running Elasticsearch container is usually available at localhost:5601.)
- In the search-gov root directory, rebuild your Elasticsearch indices:
rake usasearch:elasticsearch:create_indexes
rake 'usasearch:elasticsearch:index_all[BoostedContent+FeaturedCollection+FederalRegisterDocument+IndexedDocument+NewsItem+SaytSuggestion]'
Exit code 137 indicates that a container was killed after it ran out of memory. This can usually be resolved by increasing the memory allotted to your Docker containers (in Docker Desktop: Preferences > Resources > Advanced).
NOTE: The commands below will take quite a while to run. Use only when under extreme duress.
# Purge data stored in Docker volumes:
docker compose down -v
# Recreate the images w/o using caches
docker compose build --no-cache
# Recreate containers
docker compose up --force-recreate