windows 에서 설치되었다는 가정하에 설명드림
도커를 처음 설치하고,
명령 프롬프트(windows버튼+R → cmd 입력) 를 실행한 후,
아래 명령어를 수행한다.
docker run hello-world
그럼
Unable to find image 'hello-world:latest' locally
라는 메시지가 나온 후에 시간이 좀 지나서 아래의 메시지를 볼 수 있다.
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:2498fce14358aa50ead0cc6c19990fc6ff866ce72aeb5546e1d59caac3d0d60f
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/
docker를 처음 설치했기 때문에
아무런 이미지도 만들어진 것이 없을 것이고,
hello-world 를 local(본인 컴퓨터)에서 찾아봐도 당연히 없을 것이기 때문에
도커 서버에서 hello-world 이미지를 가져오고, 로컬에 보관하게 된다.
그럼 hello-world 이미지가 로컬에 있으니, 그 이미지를 이용해서 컨테이너를 생성하게 되는 식이다.
다시 명령프롬프트에
docker run hello-world 명령어를 수행하게 되면
이전에 보았던
Unable to find image 'hello-world:latest' locally 메시지는 볼 수 없다.
말 그대로, 로컬에서 hello-world 이미지가 있기 때문에
찾을 수 없다는 메시지가 없고,
보관된 hello-world 이미지를 이용해 컨테이너를 만든 후 프로그램을 실행하게 된다.
'docker' 카테고리의 다른 글
docker 도커 파일 FROM, WORKDIR, COPY, CMD, RUN (0) | 2022.01.04 |
---|---|
docker 도커에서 redis 실행하기 (0) | 2022.01.03 |
docker 도커 명령어 모음 (0) | 2022.01.03 |
docker 도커 설치방법 (window 윈도우) / WSL 2 설치 (0) | 2022.01.02 |