Skip to content

Latest commit

 

History

History
51 lines (43 loc) · 1.05 KB

DOCKER.md

File metadata and controls

51 lines (43 loc) · 1.05 KB

#start docker with interact mode

docker run -t -i ubuntu /bin/bash

#remove all containers

docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)

#remove all images

docker rmi $(docker images -q)

mount a host directory

URL: https://docs.docker.com/userguide/dockervolumes/

docker run -i -t -v /data/okapi:/home/okapi/data canadatom/okapi-docker-file /bin/bash

stop a container

ctrl+d

start a container

list all containers

docker ps -a 

start the container with id

docker start [container_id]

attach the container

docker attach [container_id]

list all containers name and IP

docker ps | tail -n +2 | while read -a a; do name=${a[$((${#a[@]}-1))]}; echo -ne "$name\t"; docker inspect $name | grep IPAddress | cut -d \" -f 4; done

list all containers name and gitsha

docker ps | tail -n +2 | while read -a a; do name=${a[$((${#a[@]}-1))]}; echo -ne "$name\t"; docker inspect $name | grep sha | cut -d \" -f 4 | awk -F "@" '{print $2}'; done