Podman
설치
- Arch Linux
- Debian
sudo pacman -S podman
yay -S podman-desktop
sudo apt install podman
flatpak install flathub io.podman_desktop.PodmanDesktop
명령어
run
podman run [<options>] <image> [<command> [<arg> ...]]
새로운 컨테이너에 명령어를 실행합니다.
<options>
--cpus <number>
: CPU limit-d|--detach
: 컨테이너를 백그라운드에서 실행하고 컨테이너 ID를 프린트--entrypoint <command>|'["<command>", "<arg>", ..."]'
: Dockerfile의ENTRYPOINT
에 해당합 니다.--env-file <path>
:.env
처럼 환경 변수 값이 있는 파일로 환경 변수 설정-e|--env <key>[=<value>]
: 환경 변수 설정<key>
만 있는 경우 호스트에서 해당 환경 변수를 찾아 설정하고 없으면 설정하지 않습니다.*
glob를 사용할 수 있습니다.
-it
: STDIN를 열고 컨테이너에 가상 터미널 할당-m|--memory <number><unit>
: 메모리 limit<unit>
:b
,k
,m
,g
--name <containerName>
: 컨테이너 이름--network "host"
: 호스트 네트워크 사용-p|--publish <hostPort>:<containerPort>[/<protocol>]
: 포트 포워딩--rm
: 종료 시 컨테이너 삭제-v|--volume <hostDir>:<containerDir>[:<options>]
: 호스트 디렉토리를 컨테이너 디렉토리에 마운트<options>
ro
: 읽기 전용rw
: 읽기 쓰기z
: 공유 볼륨으로 설정하여 모든 컨테이너가 읽고 쓸 수 있습니다.
[<command> [<arg> ...]]
- Dockerfile의
CMD
에 해당합니다.
- Dockerfile의
ps
podman ps [options]
- options
-a|--all
: 모든 컨테이너 출력-l|--latest
: 마지막 컨테이너 출력
exec
podman exec [options] <containerID|containerName> <command> [arg ...]
실행중인 컨테이너에 명령어를 실행합니다.
- options
-it
: STDIN을 열고 컨테이너에 가상 터미널 할당