skip to Main Content

Why are containers created on different hosts with the same version of Docker image, one with ls command and the other without itimg

i search almost document, does not found the answer, i want to know the reason of this, cause the situation?

2

Answers


  1. Chosen as BEST ANSWER

    machine A's output

    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
    

    machine B's output

    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
    

    machine A's info

    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
    

    machine B's info

    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
    

  2. The versions of Docker on your machine A (v20.10.24) and machine B (v19.03.13) are different, so they are most likely reading the docker run command differently. Based on the information in this answer, you need to rearrange the command options on machine B.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search