소개
이 랩에서는 고대 미로에 몰입하여, 미궁 깊숙이 숨겨진 귀중한 보물을 찾아야 하는 보물 사냥꾼의 역할을 맡게 됩니다. 보물 사냥꾼으로서 여러분의 목표는 미로를 탐색하여 보물을 찾는 것이며, 이는 Docker 이미지를 레포지토리 (repository) 에서 가져오는 과정과 유사합니다.
이 랩에서는 고대 미로에 몰입하여, 미궁 깊숙이 숨겨진 귀중한 보물을 찾아야 하는 보물 사냥꾼의 역할을 맡게 됩니다. 보물 사냥꾼으로서 여러분의 목표는 미로를 탐색하여 보물을 찾는 것이며, 이는 Docker 이미지를 레포지토리 (repository) 에서 가져오는 과정과 유사합니다.
Imagine yourself standing at the entrance of a mystical maze, ready to embark on a thrilling quest for hidden treasure. Docker, much like this maze, holds a world of possibilities waiting to be explored. In this step, let's dive into the labyrinth of containers and images, setting the stage for an exciting journey into the realm of Docker.
Just as a treasure hunter meticulously studies maps and clues, you will begin your Docker journey by navigating the repository – the treasure trove of container images. The repository is akin to a vast library, housing a myriad of Docker images, each serving a unique purpose.
Your first task is to identify the image that aligns with your quest. Much like choosing the right tool for the job, selecting the perfect Docker image is crucial for a successful expedition. Utilize commands like docker search to sift through the repository, unveiling the hidden gems that await your discovery.
docker search <keyword>
Replace <keyword> with terms relevant to your quest, and witness as Docker unveils a list of potential images, each holding the promise of fulfilling your objectives.
For example, search for the image that named alpine, you can use the following command.
cd ~/project
docker search alpine
If you run the command correctly, the output must be like the following:
$ docker search alpine
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
alpine A minimal Docker image based on Alpine Linux… 10557 [OK]
alpinelinux/docker-cli Simple and lightweight Alpine Linux image wi… 9
alpinelinux/alpine-gitlab-ci Build Alpine Linux packages with Gitlab CI 3
alpinelinux/gitlab-runner-helper Helper image container gitlab-runner-helper … 4
alpinelinux/rsyncd 2
alpinelinux/unbound 9
alpinelinux/alpine-drone-ci Build Alpine Linux packages with drone CI 0
alpinelinux/docker-compose docker-compose image based on Alpine Linux 2
alpinelinux/apkbuild-lint-tools Tools for linting APKBUILD files in a CI env… 0
alpinelinux/gitlab-runner Alpine Linux gitlab-runner (supports more ar… 5
alpinelinux/ansible Ansible in docker 9
alpinelinux/darkhttpd 2
alpinelinux/docker-alpine 0
alpinelinux/golang Build container for golang based on Alpine L… 2
alpinelinux/alpine-docker-gitlab Gitlab running on Alpine Linux 0
grafana/alpine Alpine Linux with ca-certificates package in… 6
alpinelinux/docker-abuild Dockerised abuild 0
alpinelinux/alpine-www The Alpine Linux public website (www.alpinel… 0
Docker 의 미로를 더 깊이 탐험하면서, 숨겨진 비밀을 풀 수 있는 열쇠인 고대 지도를 발견하게 됩니다. 이 지도는 Docker 이미지와 마찬가지로 궁극적인 보물을 찾는 여정에 대한 안내를 약속합니다.
docker pull <keyword>
식별된 이미지의 이름으로 docker pull 명령을 실행하여, 고대 지도를 펼쳐 복잡한 세부 사항을 드러내는 것과 같습니다. 이 작업은 이미지를 가져와 앞으로의 여정에 필요한 필수 지식을 제공합니다.
Docker 영역에서 지도 이미지는 청사진 역할을 하며, 컨테이너화된 환경의 구성, 종속성 및 복잡성에 대한 통찰력을 제공합니다. 이는 컨테이너의 미로를 안내하는 길잡이 역할을 합니다.
이 단계에서는 alpine이라는 이름의 이미지를 가져와야 합니다. 터미널에서 다음 명령을 실행할 수 있습니다.
docker pull alpine
명령을 올바르게 실행하면 출력은 다음과 같아야 합니다.
$ docker pull alpine
docker pull alpine
Using default tag: latest
latest: Pulling from library/alpine
59bf1c3509f3: Pull complete
Digest: sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300
Status: Downloaded newer image for alpine:latest
docker.io/library/alpine:latest
Docker 미로의 중심에서, 당신은 서로 다른 영역으로 이어지는 복도로 둘러싸인 교차로에 도착합니다. 다음 작업은 Docker 컨테이너를 활성화하여 이러한 복도를 통과하는 것입니다. 이 단계는 가져온 이미지에서 컨테이너를 실행하는 과정과 유사하며, 컨테이너화된 환경의 복잡한 복도를 통과하는 여정을 시작합니다.
docker run -it --name <container_name> <map_image> <command>
docker run 명령을 실행하여 컨테이너가 활성화될 준비를 합니다. -it 플래그는 대화형 액세스를 제공하여 컨테이너 복도를 원활하게 탐색할 수 있도록 합니다. <container_name>을 퀘스트와 관련된 이름으로 바꾸고, <command>를 컨테이너가 실행되기를 원하는 올바른 Linux shell command로 바꿔 이 광대한 Docker 미로에서 컨테이너를 식별 가능한 개체로 만듭니다.
이 단계에서는 alpine_container라는 이름의 컨테이너를 실행하고 /bin/sh 명령을 실행하도록 해야 합니다. 터미널에서 다음 명령을 실행할 수 있습니다.
docker run -it --name alpine_container alpine /bin/sh
명령을 올바르게 실행하면 출력은 다음과 같아야 합니다.
$ docker run -it --name alpine_container alpine /bin/sh
/ ## ls -a
. .dockerenv dev home media opt root sbin sys usr
.. bin etc lib mnt proc run srv tmp var
/ #
이 랩에서는 숨겨진 보물을 찾기 위해 고대 미로를 통과하는 스릴 넘치는 모험을 시작했으며, 이는 Docker 이미지를 레포지토리에서 가져오는 과정과 유사합니다. 각 단계를 실행함으로써 Docker 생태계를 탐색하는 실질적인 경험을 얻었으며, 미로 탐험을 모방하고 궁극적으로 컨테이너화 세계에 대한 귀중한 통찰력을 얻었습니다.