nginx 为什么容器在不同的主机上使用相同版本的Docker镜像创建,一个使用ls命令,另一个没有它?

e5nszbig  于 12个月前  发布在  Nginx
关注(0)|答案(1)|浏览(168)

为什么在不同的主机上使用相同版本的Docker镜像创建容器,一个使用ls命令,另一个不使用它。the question image

我搜索了几乎所有的文档,都没有找到答案,我想知道这是什么原因,造成的情况?

机器A的产量

docker run -it --name nginx --entrypoint ls nginx:1.25.1 /etc
adduser.conf            fonts      ld.so.cache    passwd       shadow
alternatives            fstab      ld.so.conf     passwd-      shadow-
apt                     gai.conf   ld.so.conf.d   profile      shells
bash.bashrc             group      libaudit.conf  profile.d    skel
bindresvport.blacklist  group-     localtime      rc0.d        ssl
ca-certificates         gshadow    login.defs     rc1.d        subgid
ca-certificates.conf    gshadow-   logrotate.d    rc2.d        subuid
cron.d                  gss        mke2fs.conf    rc3.d        systemd
cron.daily              host.conf  motd           rc4.d        terminfo
debconf.conf            hostname   mtab           rc5.d        timezone
debian_version          hosts      nginx          rc6.d        update-motd.d
default                 init.d     nsswitch.conf  rcS.d        xattr.conf
deluser.conf            inputrc    opt            resolv.conf
dpkg                    issue      os-release     rmt
e2scrub.conf            issue.net  pam.conf       security
environment             kernel     pam.d          selinux

字符串
机器B的输出

docker run -it --name nginx --entrypoint ls  nginx:1.25.1 /etc     
docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"ls\": executable file not found in $PATH": unknown.
ERRO[0000] error waiting for container: context canceled


机器A的信息

uname -a
Linux ubuntu2204.localdomain 5.15.0-69-generic #76-Ubuntu SMP Fri Mar 17 17:19:29 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.10.4)
  compose: Docker Compose (Docker Inc., v2.17.2)

Server:
 Containers: 2
  Running: 1
  Paused: 0
  Stopped: 1
 Images: 2
 Server Version: 20.10.24
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runtime.v1.linux runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 2806fc1057397dbaeefbea0e4e17bddfbd388f38
 runc version:
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.15.0-69-generic
 Operating System: Ubuntu Core 22
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 7.763GiB
 Name: ubuntu2204.localdomain
 ID: C75T:TAOG:RQZP:LIYO:3MRE:W5ER:5I2D:IMUC:PTQP:LWZL:62KP:U5XQ
 Docker Root Dir: /var/snap/docker/common/var-lib-docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Registry Mirrors:
  https://xxx
 Live Restore Enabled: false


机器B的信息

uname -a
Linux master 3.10.0-1160.an7.x86_64 #1 SMP Thu Oct 14 16:04:36 CST 2021 x86_64 x86_64 x86_64 GNU/Linux

docker info
Client:
 Debug Mode: false

Server:
 Containers: 145
  Running: 76
  Paused: 0
  Stopped: 69
 Images: 252
 Server Version: 19.03.13
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: systemd
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: ea765aba0d05254012b0b9e595e995c09186427f
 runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 3.10.0-1160.an7.x86_64
 Operating System: Anolis OS 7.9
 OSType: linux
 Architecture: x86_64
 CPUs: 6
 Total Memory: 11.58GiB
 Name: master
 ID: TMQB:QWTV:CQMU:FN32:TUU4:XQBZ:I4F3:DMX2:U4BV:MRU3:5JU6:YJHR
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http://172.31.1.1:8070
 HTTPS Proxy: http://172.31.1.1:8070
 No Proxy: 127.0.0.0/8,10.0.0.0/8,172.0.0.0/8,192.168.0.0/16,169.254.0.0/16,100.0.0.0/8,168.0.0.0/8,localhost,svc,local
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Registry Mirrors:
  https://xxx
 Live Restore Enabled: false

rwqw0loc

rwqw0loc1#

机器A(v20.10.24)和机器B(v19.03.13)上的Docker版本不同,因此它们很可能以不同的方式阅读docker run命令。根据this answer中的信息,您需要重新排列机器B上的命令选项。

相关问题