728x90
반응형
Docker 확인
# docker ps -a
CONTAINER ID   IMAGE                                           COMMAND                  CREATED          STATUS         PORTS                                       NAMES
77d5896ee529   quay.io/prometheus/alertmanager                 "/bin/alertmanager -…"   42 minutes ago   Up 7 minutes   0.0.0.0:9093->9093/tcp, :::9093->9093/tcp   alertmanager
d5e072461359   quay.io/prometheuscommunity/postgres-exporter   "/bin/postgres_expor…"   43 hours ago     Up 2 hours     0.0.0.0:9187->9187/tcp, :::9187->9187/tcp   postgres-exporter
e841da551b71   postgres                                        "docker-entrypoint.s…"   5 days ago       Up 2 hours     0.0.0.0:5432->5432/tcp, :::5432->5432/tcp   postgres

 

Docker 세부정보 확인
# docker 계정정보 확인  (컨테이너 id가 77d5896ee529 ---> alertmanager docker)

# docker exec 77d5896ee529 cat /etc/passwd
root:x:0:0:root:/root:/bin/sh
daemon:x:1:1:daemon:/usr/sbin:/bin/false
bin:x:2:2:bin:/bin:/bin/false
sys:x:3:3:sys:/dev:/bin/false
sync:x:4:100:sync:/bin:/bin/sync
mail:x:8:8:mail:/var/spool/mail:/bin/false
www-data:x:33:33:www-data:/var/www:/bin/false
operator:x:37:37:Operator:/var:/bin/false
nobody:x:65534:65534:nobody:/home:/bin/false

# docker home 디렉토리 확인
/# docker exec 77d5896ee529 pwd
/alertmanager

# docker env 정보 확인
# docker exec 77d5896ee529 env
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=77d5896ee529
HOME=/home

# docker exec 77d5896ee529 uname -a
Linux 77d5896ee529 5.15.0-83-generic #92-Ubuntu SMP Mon Aug 14 09:30:42 UTC 2023 x86_64 GNU/Linux

# # docker exec 77d5896ee529 uname -s
Linux

# docker exec 77d5896ee529 uname -r
5.15.0-83-generic

# docker exec 77d5896ee529 uname -v
92-Ubuntu SMP Mon Aug 14 09:30:42 UTC 2023

# docker exec 77d5896ee529 cat /proc/version
Linux version 5.15.0-83-generic (buildd@lcy02-amd64-027) (gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #92-Ubuntu SMP Mon Aug 14 09:30:42 UTC 2023

 

Docker 컨테이너 접속시 Error
  • /bin/bash 지원하지 않을 경우 /bin/sh로 접속
# docker exec -it 77d5896ee529 /bin/bash
OCI runtime exec failed: exec failed: unable to start container process: exec: "/bin/bash": stat /bin/bash: no such file or directory: unknown

# docker exec 77d5896ee529 env
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=77d5896ee529
HOME=/home

# docker exec 77d5896ee529 ls /bin/bash       # env로 볼때 /bin/bash가 없음
ls: /bin/bash: No such file or directory

# docker exec 77d5896ee529 ls /bin/sh         # sh는 있는 지 확인
/bin//sh

# docker exec -it 77d5896ee529 /bin/sh         # sh로 접속
/alertmanager $

 

728x90
반응형
LIST

'docker' 카테고리의 다른 글

Docker Desktop에 Grafana 연결 및 설치  (0) 2024.06.07
Docker 개요 및 명령어  (0) 2024.02.11

+ Recent posts