Difference between revisions of "Docker goodies"

From BITPlan profiwiki Wiki
Jump to navigation Jump to search
Line 17: Line 17:
 
docker rmi -f $(docker images -f "dangling=true" -q)
 
docker rmi -f $(docker images -f "dangling=true" -q)
 
</source>
 
</source>
 +
 +
=== remove old unused docker containers ===
 +
* http://stackoverflow.com/a/17237701/1497139
 +
<source lang='bash'>
 +
docker ps -a | grep 'weeks ago' | awk '{print $1}' | xargs --no-run-if-empty docker rm
 +
</source>
 +
  
 
=== Support for build env variables ===
 
=== Support for build env variables ===
 
Upcoming feature in 1.9?
 
Upcoming feature in 1.9?
 
* https://github.com/docker/docker/issues/6822
 
* https://github.com/docker/docker/issues/6822

Revision as of 13:47, 23 October 2015

Copy a file from a container to the host system

docker cp <containerId>:/file/path/within/container /host/path/target

Attach to a running container

docker exec -it $containername /bin/bash

Remove untagged docker images

http://stackoverflow.com/a/28377696/1497139

docker rmi -f $(docker images -f "dangling=true" -q)

remove old unused docker containers

docker ps -a | grep 'weeks ago' | awk '{print $1}' | xargs --no-run-if-empty docker rm


Support for build env variables

Upcoming feature in 1.9?