hello world

2020. 10. 4. 01:28클라우드/Docker

hello-world 컨테이너 실행하기

run은 이미지가 없으면 자동으로 이미지를 다운로드한다.

$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
0e03bdcc26d7: Pull complete 
Digest: sha256:4cf9c47f86df71d48364001ede3a4fcd85ae80ce02ebad74156906caff5378bc
Status: Downloaded newer image for hello-world:latest

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/

 

로컬에서 hello-world라는 도커 이미지를 찾지 못했다.

DockerHub에서 이미지를 받아왔다. (Pull complete)

받아온 hello-world 이미지를 이용해 컨테이너를 만들고 실행시켰다.

 

Docker Desktop

$ docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                       PORTS                     NAMES
2e6f118f69f7        hello-world         "/hello"                 5 minutes ago       Exited (0) 5 minutes ago                               wizardly_cohen
0d02e7bd3559        mysql:5.7.19        "docker-entrypoint.s…"   10 months ago       Exited (255) 10 months ago   0.0.0.0:43306->3306/tcp   lecture-mysql

도커 데스크탑 어플리케이션이나  ps 명령어를 통해 실행중인 컨테이너 목록을 출력해보면

hello-world가 있는 것을 확인할 수 있다.

 

$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              bf756fb1ae65        9 months ago        13.3kB
mysql               5.7.19              3e3878acd190        2 years ago         412MB

다운로드 한 이미지 목록을 확인해보면 hello-world 이미지가 다운 된 것을 확인할 수 있다.

 

 

'클라우드 > Docker' 카테고리의 다른 글

Dockerizing Spring Boot Application  (0) 2020.10.04
Dockerfile  (0) 2020.10.04
Docker Image  (0) 2020.10.01
Docker Container  (0) 2020.10.01
Docker  (0) 2020.09.30