본문으로 바로가기

docker 설치

https://docs.docker.com/engine/install/

 

Install Docker Engine

 

docs.docker.com

 sudo apt-get update
 sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release
 sudo apt-get update
 sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin

docker 설치 확인 및 hello-world 실행

docker 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-compose 설치

https://docs.docker.com/compose/install/

 

Install Docker Compose

 

docs.docker.com

sudo apt install docker-compose

docker-compose로 hello-world 실행

docker-compose.yml 파일 작성

version: '3'
services:
  hello_world:
    image: ubuntu
    command: [/bin/echo, 'Hello world']

https://hub.docker.com/_/hello-world

 

Hello-world - Official Image | Docker Hub

We and third parties use cookies or similar technologies ("Cookies") as described below to collect and process personal data, such as your IP address or browser information. You can learn more about how this site uses Cookies by reading our privacy policy

hub.docker.com

같은 폴더내에서 실행

docker-compose up