Alpine docker 컨테이너 구동하고 들어가보기

1 개요[ | ]

alpine docker 컨테이너 구동하고 들어가보기

2 docker run[ | ]

docker run -it --name myalpine alpine /bin/sh
→ 이름을 myalpine이라고 지정하였다.
→ 이름을 지정하는 이유는, 삭제하거나 할 때 식별이 용이하기 때문이다.

2.1 실습[ | ]

docker run -it --name myalpine alpine /bin/sh
cat /etc/os-release
docker rm myalpine
$ docker run -it --name myalpine alpine /bin/sh
/ # hostname
33dfa7d92902
/ # cat /etc/os-release
3.11.5
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.11.5
PRETTY_NAME="Alpine Linux v3.11"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://bugs.alpinelinux.org/"
/ #
/ # ps -ef
PID   USER     TIME  COMMAND
    1 root      0:00 /bin/sh
    8 root      0:00 ps -ef
/ # exit
$ docker rm myalpine
myalpine
$

3 docker run & docker exec[ | ]

컨테이너를 detached 상태로 구동해두고, 이후에 exec로 들어가 보기

docker run -d --name myalpine alpine
docker exec -it myalpine  /bin/sh

3.1 실습[ | ]

docker run -d --name myalpine alpine
docker exec -it myalpine  /bin/sh
$ docker run -d --name myalpine alpine sleep infinity
ed6d945385366f3ca7eedcc059edb0e5013e096e2684ce89152e5789fdc600b8
$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
ed6d94538536        alpine              "sleep infinity"    5 seconds ago       Up 4 seconds                            myalpine
$ docker exec -it ed6d94538536 /bin/sh
/ # cat /etc/os-release
3.11.5
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.11.5
PRETTY_NAME="Alpine Linux v3.11"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://bugs.alpinelinux.org/"
/ # ps -ef
PID   USER     TIME  COMMAND
    1 root      0:00 sleep infinity
    6 root      0:00 /bin/sh
   12 root      0:00 ps -ef
/ # exit
$ docker rm -f myalpine
myalpine
$

4 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}