Docker – Quick Reference

A quick reference guide to common Docker commands.

# to pull a container image
docker pull nginx

# to make container - persistant container that mounts conf and webroot
docker run --name repo-nginx -p 80:80 --restart unless-stopped -v /data/scratch/repo-nginx:/usr/share/nginx/html -v /data/docker/repo-nginx/default.conf:/etc/nginx

# Remove all stopped containers
docker system prune -f

#to all list containers
docker ps -a

#to list active containers
docker ps

# to start
docker start <container name>

# to stop
docker start <container name>

# to remove
docker rm <container name>

# if you are having issues with a container - views last 50 log entries
docker logs --tail 50 --follow --timestamps <container name>

# list docker networks
docker network ls

Join the Conversation

1 Comment

Leave a comment

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

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax