첫 번째 컨테이너 실행하기

DockerBeginner
지금 연습하기

소개

"첫 번째 컨테이너 실행하기" 챌린지에 오신 것을 환영합니다! 여러분은 이미 hello-world 컨테이너를 실행하는 방법을 배웠습니다. 이제 한 걸음 더 나아가 색다르고 흥미로운 컨테이너를 실행해 보겠습니다. 이번 챌린지에서는 지금까지 익힌 도커 기술을 활용하여 유용한 메시지를 보여주는 컨테이너를 직접 구동해 볼 것입니다.

이 콘텐츠는 챌린지입니다. 가이드가 제공되는 일반 실습과 달리, 학습 단계를 그대로 따라가는 것이 아니라 스스로 과제를 해결해야 합니다. 챌린지는 다소 어려울 수 있지만, 해결이 막막하다면 Labby 와 상담하거나 모범 답안을 확인할 수 있습니다. 통계에 따르면 이 챌린지는 초급 수준으로 94%의 통과율을 기록하고 있으며, 학습자들로부터 99%의 긍정적인 평가를 받았습니다.

새 컨테이너 실행

과제

수행해야 할 과제는 간단합니다:

  1. docker/getting-started 이미지를 기반으로 도커 컨테이너를 실행하세요.

요구 사항

챌린지를 성공적으로 완료하려면 다음 조건을 충족해야 합니다:

  1. docker run 명령어를 사용하여 컨테이너를 시작해야 합니다.
  2. docker/getting-started 이미지를 사용하세요. 이 이미지는 이미 시스템에 내려받아져 (pre-pulled) 있습니다.
  3. ~/project 디렉토리에서 명령어를 실행하세요.

예시

컨테이너를 성공적으로 실행하면 도커와 관련된 정보가 포함된 출력 결과가 나타납니다.

실행 도중 /docker-entrypoint.d/ 디렉토리가 비어 있지 않다는 경고 메시지가 나타나더라도 당황하지 마세요. 정상적인 동작입니다.

/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
2024/10/29 09:26:17 [notice] 1#1: using the "epoll" event method
2024/10/29 09:26:17 [notice] 1#1: nginx/1.23.3
2024/10/29 09:26:17 [notice] 1#1: built by gcc 12.2.1 20220924 (Alpine 12.2.1_git20220924-r4)
2024/10/29 09:26:17 [notice] 1#1: OS: Linux 5.15.0-56-generic
2024/10/29 09:26:17 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2024/10/29 09:26:17 [notice] 1#1: start worker processes
2024/10/29 09:26:17 [notice] 1#1: start worker process 31
2024/10/29 09:26:17 [notice] 1#1: start worker process 32

새 터미널 창을 열고 docker ps 명령어를 사용하여 컨테이너가 실제로 실행 중인지 확인할 수 있습니다.

docker ps
CONTAINER ID   IMAGE               COMMAND                  CREATED          STATUS          PORTS     NAMES
f3f3b3b3b3b3   docker/getting-started   "/docker-entrypoint.…"   1 minute ago   Up 1 minute   80/tcp   festive_mendel

주의: Continue 버튼을 클릭하기 전까지는 터미널을 종료하지 마세요.

✨ 솔루션 확인 및 연습

요약

이번 챌린지를 통해 새로운 컨테이너를 직접 실행해 보며 도커 실력을 한 단계 높였습니다. docker run 명령어로 docker/getting-started 이미지를 실행하여 도커에 대한 소개 정보를 확인해 보았습니다. 이 과정에서 도커를 활용해 컨테이너를 구동하는 방법을 복습하고, 유용한 정보를 담고 있는 새로운 도커 이미지를 접해 보았습니다. 도커를 사용하면 미리 설정된 애플리케이션에 얼마나 빠르고 간편하게 접근할 수 있는지 체감할 수 있는 좋은 기회였습니다. 앞으로도 다양한 도커 이미지를 탐색하며 컨테이너화 기술을 계속해서 확장해 나가시기 바랍니다!