Docker

Images

# List all docker images
docker images
or
docker image ls

# Install / get from docker hub
docker pull linode/lamp 

docker run --name ronspin -p 80:80 -t -i linode/lamp /bin/bash
docker run --rm  -v "$PWD" -w /usr/src/myapp php:7.0-cli cat /etc/*-release

docker exec -it ronspin /bin/bash

# Cleanup Dangling images 
docker rmi $(docker images --filter "dangling=true" -q --no-trunc)

Containers

# Docker list all containers
docker ps -a

# Restart a down/exited container?
docker start [a container id, example ec6163c5a5b1]

# Stop a container
docker stop [a container id, or name]

# Delete a container
docker rm [a container id, example ec6163c5a5b1]

# Exit from container interactive mode and let it run as daemon
ctrl+p, ctrl+q

# Copy from a container to host
docker cp :/file/path/within/container /host/path/target

Leave a Reply

Your email address will not be published. Required fields are marked *


five × = 30