Docker使い方
Table of Contents
install
$ sudo apt -y install apt-transport-https ca-certificates curl software-properties-common $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - $ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" $ sudo apt update $ sudo apt -y install docker-ce $ sudo usermod -a -G docker ${USER}
image削除
$ docker ps -a
$ docker rm コンテナID
$ docker image rmi イメージID
指定されたイメージを先祖として持つコンテナーを検索、削除
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
59d33ae59a2e nginx "/docker-entrypoint.…" 2 hours ago Up 2 hours 0.0.0.0:8080->80/tcp, :::8080->80/tcp web_server
$ docker ps -a -f "ancestor=nginx" -q
59d33ae59a2e
$ docker rm `docker ps -a -f "ancestor=nginx" -q`