podman docker-compose -H unix:///run/user/$UID/podman/podman.sock up -d 별칭

podman docker-compose -H unix:///run/user/$UID/podman/podman.sock up -d 별칭

이 명령은 podman rootless 및 docker-compose를 사용하여 컨테이너를 실행합니다. 이에 대한 별칭을 만드는 것이 가능합니까?

docker-compose -H unix:///run/user/$UID/podman/podman.sock up -d

답변1

다음 별칭을 생략하면 작동합니다.up -d

alias dc="docker-compose -H unix:///run/user/$UID/podman/podman.sock"

고쳐 쓰다

.bashrc의 별칭

alias dc='docker-compose -H unix:///run/user/$UID/podman /podman.socket'

dc예상 출력을 실행하고 생성합니다.

[user@server1 ~]$ dc
Define and run multi-container applications with Docker.

Usage:
  docker-compose [-f <arg>...] [--profile <name>...] [options] [--] [COMMAND] [ARGS...]
  docker-compose -h|--help

Options:
  -f, --file FILE             Specify an alternate compose file
                              (default: docker-compose.yml)
  -p, --project-name NAME     Specify an alternate project name
                              (default: directory name)
  --profile NAME              Specify a profile to enable
  -c, --context NAME          Specify a context name
  --verbose                   Show more output
  --log-level LEVEL           Set log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
  --ansi (never|always|auto)  Control when to print ANSI control characters
  --no-ansi                   Do not print ANSI control characters (DEPRECATED)
  -v, --version               Print version and exit
  -H, --host HOST             Daemon socket to connect to

  --tls                       Use TLS; implied by --tlsverify
  --tlscacert CA_PATH         Trust certs signed only by this CA
  --tlscert CLIENT_CERT_PATH  Path to TLS certificate file
  --tlskey TLS_KEY_PATH       Path to TLS key file
  --tlsverify                 Use TLS and verify the remote
  --skip-hostname-check       Don't check the daemon's hostname against the
                              name specified in the client certificate
  --project-directory PATH    Specify an alternate working directory
                              (default: the path of the Compose file)
  --compatibility             If set, Compose will attempt to convert keys
                              in v3 files to their non-Swarm equivalent (DEPRECATED)
  --env-file PATH             Specify an alternate environment file

dc up -d예외를 던진다

[user@server1 nextcloud]$ dc up -d
Traceback (most recent call last):
  File "urllib3/connectionpool.py", line 677, in urlopen
  File "urllib3/connectionpool.py", line 392, in _make_request
  File "http/client.py", line 1277, in request
  File "http/client.py", line 1323, in _send_request
  File "http/client.py", line 1272, in endheaders
  File "http/client.py", line 1032, in _send_output
  File "http/client.py", line 972, in send
  File "docker/transport/unixconn.py", line 43, in connect
FileNotFoundError: [Errno 2] No such file or directory

관련 정보