Docker Code Snippets - WBowam/wbowam.github.com GitHub Wiki

Date: 2015-05-15
Title: Docker ๅ‘ฝไปค็ขŽ็‰‡
Tags: Snippets, Docker
Category: IT

build DockerFile

sudo docker build .

docker run

docker run -it tulpar008/blog /bin/bash

docker commit

docker commit -m "..." CONTAINER_ID tulpar008/blog:v2.1

stop or rm all running container

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

upgrade your docker

curl -sSL https://get.docker.com/ubuntu/ | DOCKER_VERSION=1.3.3 sh

# Or using a specific path?

curl -sSL https://get.docker.com/1.3.3/ubuntu/ | sh

attach or exec

# attach
$ sudo docker attach 665b4a1e17b6 #by ID
## or
$ sudo docker attach loving_heisenberg #by Name

# exec
$ sudo docker exec -i -t 665b4a1e17b6 bash #by ID
or
$ sudo docker exec -i -t loving_heisenberg bash #by Name