Skip to content

Instantly share code, notes, and snippets.

@dishitd
Last active May 25, 2020 23:58
Show Gist options
  • Save dishitd/3e9d4a8081f5749052b4ef5f6ba60ddd to your computer and use it in GitHub Desktop.
Save dishitd/3e9d4a8081f5749052b4ef5f6ba60ddd to your computer and use it in GitHub Desktop.
Docker cheatsheet
# Dockerfile
FROM reports/metabase:v1
LABEL maintainer="dishid@gmail.com"
EXPOSE 3000
docker commit -m "Message" -a "Author Name" [containername] [imagename]
docker commit -m "Initial Commit" -a "Dishit D" metabase reports/metabase:v1
# Create image from Dockerfile
docker build -t reports/metabase:v2 .
# Run docker build
docker run -d -p 13020:3000 --name metabase reports/metabase:v2
# Create docker service
docker service create -p 13020:3000 --name reports/metabase reports/metabase:v2
# Docker service commands
docker service ls
docker service rm redis
docker service logs
# Docker images commands
docker images
docker image rm <containerid>
# Docker stop container
docker stop <containername/conatainerid>
# Get log file
docker inspect <conatiner name> | grep logs
docker stats --no-stream --format "table {{.Name}}\t{{.Container}}\t{{.CPUPerc}}\t{{.MemUsage}}" | sort -k 4 -h
# Copy file from container to local disk
docker cp ffs-billing:/uploads/0503\ -\ Surge\ Protector\ Order\ History\ check.xls /tmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment