Some useful docker commands

Jul - 25 2016 | By

kill all UP docker containers

docker stop $(docker ps | awk ‘/Up/ { print $1}’) 2>/dev/null || echo ‘There are no running containers!’

 

 

remove all Exited Docker images

rm $(docker ps -a | awk ‘/Exited/ { print $1}’) 2>/dev/null || echo ‘Nothing to remove’

 

 

running in interaction mode – while linking the applications log file to a local directory

docker run -it –entrypoint=bash -v /Users/XXX/log:/var/log \

-e VARIABLE1=XXX \

-e VARIABLE2=YYY \

–net host <DOCKER IMAGE LOCATION>

 

 

running docker normally

docker run -d -v /Users/XXX/log:/var/log \

-e VARIABLE1=XXX \

-e VARIABLE2=YYY \

–net host <DOCKER IMAGE LOCATION> 

 

 

Enter a running docker image

docker exec -it [CONTAINER_ID] /bin/bash

Comments are closed. Please see front page on how to contact me