Build and tag an image from a Dockerfile
:
docker build -t name/tag .
Run image:
docker run name/tag
List running containers:
docker ps
Enter interactive bash shell in an existing container:
docker exec -it container_name bash
Start existing containers in the background without recreating from images:
docker-compose up -d --no-recreate
Stop a running container, rebuild it, then start it again in the background without restarting its dependencies:
docker-compose stop service_name
docker-compose build service_name
docker-compose up -d --no-deps service_name
Delete all non-running containers (won't affect images):
docker rm $(docker ps -a -q)
Delete "dangling" images that aren't dependencies for any tagged image or existing container:
docker rmi $(docker images -q -f dangling=true)