1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# 最新化 sudo apt update -y # Dockerリポジトリセット sudo apt-get remove docker docker-engine docker.io containerd runc sudo apt-get install -y apt-transport-https ca-certificates curl gnupg-agent 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" # Dockerインストール sudo apt update -y sudo apt-get -y install docker-ce docker-ce-cli containerd.io apt-cache madison docker-ce sudo apt-get install docker-ce=5:19.03.8~3-0~ubuntu-bionic docker-ce-cli=5:19.03.8~3-0~ubuntu-bionic containerd.io # Dockerテスト sudo docker run hello-world # Docker-Compose sudo curl -L "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose docker-compose --version # Docker-Compose テスト yuta@docker-test:~$ mkdir hello-worldyuta@docker-test:~$ cd hello-world/ yuta@docker-test:~/hello-world$ cat docker-compose.yml version: "3" services: hello: image: hello-world:latest yuta@docker-test:~/hello-world$ sudo docker-compose up Creating network "hello-world_default" with the default driver Creating hello-world_hello_1 ... done Attaching to hello-world_hello_1 hello_1 | hello_1 | Hello from Docker! hello_1 | This message shows that your installation appears to be working correctly. hello_1 | hello_1 | To generate this message, Docker took the following steps: hello_1 | 1. The Docker client contacted the Docker daemon. hello_1 | 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. hello_1 | (amd64) hello_1 | 3. The Docker daemon created a new container from that image which runs the hello_1 | executable that produces the output you are currently reading.hello_1 | 4. The Docker daemon streamed that output to the Docker client, which sent it hello_1 | to your terminal. hello_1 | hello_1 | To try something more ambitious, you can run an Ubuntu container with: hello_1 | $ docker run -it ubuntu bash hello_1 | hello_1 | Share images, automate workflows, and more with a free Docker ID: hello_1 | https://hub.docker.com/ hello_1 | hello_1 | For more examples and ideas, visit: hello_1 | https://docs.docker.com/get-started/ hello_1 | hello-world_hello_1 exited with code 0 yuta@docker-test:~/hello-world$ yuta@docker-test:~/hello-world$ sudo docker-compose ps Name Command State Ports ---------------------------------------------- hello-world_hello_1 /hello Exit 0 yuta@docker-test:~/hello-world$ |