1 | $ docker run -i -t --name alias_container_name images_name |
someUser don’t need root
sudo usermod -aG docker someUser
stop docker container
$ docker stop container_id
export single file from runing container
1 | $ docker cp name.txt container_name:/name.txt |
delete force or not
1 | $ docker rm container |
remove all stoped container
$ docker rm $(docker ps -a -q)
kill containers and remove them:
$ docker rm $(docker kill $(docker ps -aq))
remove all images
$ docker rmi $(docker images -qf "dangling=true")
docker rmi $(docker images | grep -v 'ubuntu\|my-image' | awk {'print $3'})
mount the directory to docker
$ docker run -d P --name mnistDemo -v .:/mnistDemo caffe:latest /bin/bash
link container
docker run -i -t --name container1 --net=my-network --net-alias=container1 ubuntu:trusty /bin/bash
docker expose port
$ docker run -d -p 80:80 my_image service nginx start
References: