Skip to content

Docker Code Snippets

tulpar008 edited this page Sep 10, 2015 · 4 revisions

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


Clone this wiki locally