Skip to content

docker cheatsheet

nupthale edited this page May 8, 2019 · 9 revisions

copy from image

$ docker create -it --name rde-dummy ${imageName} bash
$ docker cp rde-dummy:/usr/rde/${somePath} ${someLocalPath}
$ docker rm -fv rde-dummy

docker push

// add multiple tag, remember to add latest each time
$ docker tag ${imageId} ${remoteContainerName}:${semverTag}
$ docker tag ${imageId} ${remoteContainerName}:latest

$ docker push ${remoteContainerName}
$ docker-compose run --rm ${service} ${command}

inspect tool

https://github.com/wagoodman/dive

dive <your-image-tag>
dive build -t <some-tag> .

inspect image or container

docker run --rm -it --entrypoint=/bin/bash name-of-image
docker exec -it name-of-container bash

removal

kill all running containers with $ docker kill $(docker ps -q)
delete all stopped containers with $ docker rm $(docker ps -a -q)
delete all images with $ docker rmi $(docker images -q)