Skip to content

Instantly share code, notes, and snippets.

@joechai93
Last active March 17, 2022 22:35
Show Gist options
  • Save joechai93/2bc580190e20c0ba32cf7c87830a0612 to your computer and use it in GitHub Desktop.
Save joechai93/2bc580190e20c0ba32cf7c87830a0612 to your computer and use it in GitHub Desktop.
# Copying from host to container
docker cp ~/Downloads/<filename> 0b2a63712e29:/home/joe/<filename>
# Running a live non-persistent container
docker container run --rm -ti ubuntu:latest /bin/bash
# List and remove docker images
docker image rm d70eaf7277ea
docker image ls
# Recursive deletion of containers and images
docker rm -vf $(docker ps -aq)
docker rmi -f $(docker images -aq)
# Docker volume
docker volume create ubuntu18
docker volume ls
docker volume inspect ubuntu18
docker run -it --mount source=ubuntu18,target=/home/joe/ ubuntu:latest
# Commit a docker container to an image
docker ps
docker commit b59a1522a108 joechai/ubuntu:version0
# Push to docker hub
docker push lunetec/github-ci:tagname
# Run with mounted volume
docker run -it --rm --mount src=/home/joe,target=/home/joe,type=bind ubuntu:18.04
## For a specific commit of the ubuntu image, use
docker run -it --rm --mount src=/home/joe,target=/home/joe,type=bind ubuntu@sha256:fd25e706f3dea2a5ff705dbc3353cf37f08307798f3e360a13e9385840f73fb3
## For running arm64 images on x86
sudo apt-get install qemu binfmt-support qemu-user-static # Install the qemu packages
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes # This step will execute the registering scripts
docker run --rm -t arm64v8/ubuntu uname -m # Testing the emulation environment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment