### Ubuntu/trustyにdockerインストール済
$ sudo docker version
Client:
Version: 18.06.3-ce
API version: 1.38
Go version: go1.10.3
Git commit: d7080c1
Built: Wed Feb 20 02:27:13 2019
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 18.06.3-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: d7080c1
Built: Wed Feb 20 02:25:38 2019
OS/Arch: linux/amd64
Experimental: false
// 動作テスト
$ sudo docker run –name some-nginx -d -p 8080:80 nginx
### image一覧表示
$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
nginx latest 6678c7c2e56c 11 days ago 127MB
### Dockerコンテナ一覧
$ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
615c9946da6d nginx “nginx -g ‘daemon of…” 2 hours ago Exited (0) About an hour ago some-nginx
### hello-world imageの起動
$ sudo docker run hello-world
LocalにDocker imageがなければDocker Hubに探しにいき、Docker imageをダウンロードする
### Docker imageのダウンロード
$ docker pull?hello-world
### Dockerコンテナの削除
$ sudo docker rm ${コンテナID}
### Docker imageの削除
$ sudo docker rmi ${ImageID}
※コンテナで使われていると、imageは削除できない
$ sudo docker rmi 667
Error response from daemon: conflict: unable to delete 6678c7c2e56c (must be forced) – image is being used by stopped container 615c9946da6d
### Nginx imageを使う
$ sudo docker pull nginx
$ sudo docker run -d –name nginx-container -p 8181:80 nginx
$ sudo docker stop nginx-container