Skip to content

Instantly share code, notes, and snippets.

@Tharwat96
Last active July 2, 2020 00:41
Show Gist options
  • Save Tharwat96/3ddb4f9c5e9f796fbc061f8cd5e038b1 to your computer and use it in GitHub Desktop.
Save Tharwat96/3ddb4f9c5e9f796fbc061f8cd5e038b1 to your computer and use it in GitHub Desktop.
Docker Cheat Sheet and Tricks

Docker Cheat Sheet

Copy a file from host to container:

docker cp file.xz container_name:/tmp/file.xz

List all containers with their volumes

docker ps -a --format '{{ .ID }}' | xargs -I {} docker inspect -f '{{ .Name }}{{ printf "\n" }}{{ range .Mounts }}{{ printf "\n\t" }}{{ .Type }} {{ if eq .Type "bind" }}{{ .Source }}{{ end }}{{ .Name }} => {{ .Destination }}{{ end }}{{ printf "\n" }}' {}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment