■dockerでHello Worldしてみる。 環境は以下。 dockerをdebian stretch用からbuster用にアップグレードする。 https://labunix.hateblo.jp/entry/20200106/1578267032 $ lsb_release -d Description: Debian GNU/Linux 10 (buster) $ docker --version Docker version 18.09.1, build 4c52b90 ■プロキシの設定(サーバ) $ sudo mkdir -p /etc/systemd/system/docker.service.d $ sudo systemctl restart docker $ cat /etc/systemd/system/docker.service.d/http-proxy.conf [Service] Environment="HTTP_PROXY=http://192.168.100.200:8080" Environment="HTTPS_PROXY=http://192.168.100.200:8080" $ sudo systemctl show --property=Environment docker Environment=HTTP_PROXY=http://192.168.100.200:8080 HTTPS_PROXY=http://192.168.100.200:8080 $ docker info 2>/dev/null | grep -i proxy HTTP Proxy: http://192.168.100.200:8080 HTTPS Proxy: http://192.168.100.200:8080 ■プロキシの設定(クライアント) $ cat ~/.docker/config.json { "proxies": { "default": { "httpProxy": "http://192.168.100.200:8080", "httpsProxy": "http://192.168.100.200:8080" } } } ■基本コマンドの確認 $ echo "image container volume network" | \ awk '{for(a=1;a<=NF;a++){print "echo \042\134$docker "$a" ls\042;docker",$a,"ls"}}' | sh $docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE $docker container ls CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES $docker volume ls DRIVER VOLUME NAME $docker network ls NETWORK ID NAME DRIVER SCOPE 4f6ac6047556 bridge bridge local b181ffc1729c host host local 3511d6025db8 none null local ■Hello World $ docker container run hello-world Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/ ■ログの確認 $ docker container ls -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 90ce255d3b90 hello-world "/hello" 14 minutes ago Exited (0) 14 minutes ago youthful_meitner $ docker logs 90ce255d3b90 Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/