首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >podman.sock别名-编写-H unix:/run/user/$UID/ podman /podman.sock -d

podman.sock别名-编写-H unix:/run/user/$UID/ podman /podman.sock -d
EN

Unix & Linux用户
提问于 2021-10-04 20:56:53
回答 1查看 629关注 0票数 0

此命令使用podman、没有根目录和docker-组合来运行容器。是否可以为此创建别名?

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

EN

回答 1

Unix & Linux用户

发布于 2021-10-04 23:01:42

如果省略了up -d,下面的别名就会起作用

代码语言:javascript
复制
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运行并产生预期的输出

代码语言:javascript
复制
[user@server1 ~]$ dc
Define and run multi-container applications with Docker.

Usage:
  docker-compose [-f ...] [--profile ...] [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抛出异常

代码语言:javascript
复制
[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
票数 0
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/671848

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档