Docker Cheat Sheet

Below is a list of common and useful commands for working with docker.

List all images in local machine

docker image ls

List all running instances

docker ps -a

Stop/remove all docker images

docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)

Run a container from Docker Windows using .NET Core image

docker run --rm -it -v "$(pwd):/app" -p 5000:5000 mcr.microsoft.com/dotnet/core/sdk

(Notice the double-quotes around path, otherwise pwd will not work from Windows)

Run a container with Redis

docker run --rm -it -p 6379:6379 redis

Get into a running container

docker exec -it 55ff7be44aba /bin/bash

(Replace 55ff7be44aba with the actual container name or id)

 

Ref:

Author: Luis Carrazana

Skilled Senior Technology Consultant and Strategist, with 15+ of experience advising and assisting customers from small and large companies from multiple industries, including Pharma, Insurance and Financial Services. Leveraging the right technology for the right job. Passionate about Software Craftsmanship, Quality, Agile, DevOps and Cloud Computing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s