2015-01-15 11 views
19

Sto utilizzando Docker su MacOSX (con Boot2Docker).Perché Docker dicono che non può eseguire 'bash "?

posso correre le immagini dalla finestra mobile Hub.

Tuttavia, quando cerco di eseguire una delle mie proprie immagini come questa:

docker run -P mylocalimage 

o

docker run -P mylocalimage bin/a3-write-back 

o

... 

ottengo:

docker "env: can't execute 'bash': No such file or directory" 

Immagino che non riesce a trovare un binario bash per eseguire nel contenitore, ma perché?

L'immagine di base è errordeveloper/oracle-jdk

Grazie per qualsiasi aiuto.

Ashley.

[{ 
    "Architecture": "amd64", 
    "Author": "ABC [email protected]", 
    "Checksum": "tarsum.dev+sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", 
    "Comment": "", 
    "Config": { 
     "AttachStderr": false, 
     "AttachStdin": false, 
     "AttachStdout": false, 
     "Cmd": [], 
     "CpuShares": 0, 
     "Cpuset": "", 
     "Domainname": "", 
     "Entrypoint": [ 
      "bin/a3-write-back" 
     ], 
     "Env": [ 
      "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/jdk1.8.0_25/bin", 
      "JAVA_HOME=/usr/jdk1.8.0_25" 
     ], 
     "ExposedPorts": null, 
     "Hostname": "5bf0de3d0926", 
     "Image": "abd65ce243a5b015bb49f3e958103a5cc0c5f14938df4e480ded25f3ecf878e7", 
     "MacAddress": "", 
     "Memory": 0, 
     "MemorySwap": 0, 
     "NetworkDisabled": false, 
     "OnBuild": [], 
     "OpenStdin": false, 
     "PortSpecs": null, 
     "StdinOnce": false, 
     "Tty": false, 
     "User": "daemon", 
     "Volumes": null, 
     "WorkingDir": "/opt/docker" 
    }, 
    "Container": "987d2279b6e42195fe8e732c0637798926db6cfaeab93fcc25a3f10dac73f111", 
    "ContainerConfig": { 
     "AttachStderr": false, 
     "AttachStdin": false, 
     "AttachStdout": false, 
     "Cmd": [ 
      "/bin/sh", 
      "-c", 
      "#(nop) CMD []" 
     ], 
     "CpuShares": 0, 
     "Cpuset": "", 
     "Domainname": "", 
     "Entrypoint": [ 
      "bin/a3-write-back" 
     ], 
     "Env": [ 
      "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/jdk1.8.0_25/bin", 
      "JAVA_HOME=/usr/jdk1.8.0_25" 
     ], 
     "ExposedPorts": null, 
     "Hostname": "5bf0de3d0926", 
     "Image": "abd65ce243a5b015bb49f3e958103a5cc0c5f14938df4e480ded25f3ecf878e7", 
     "MacAddress": "", 
     "Memory": 0, 
     "MemorySwap": 0, 
     "NetworkDisabled": false, 
     "OnBuild": [], 
     "OpenStdin": false, 
     "PortSpecs": null, 
     "StdinOnce": false, 
     "Tty": false, 
     "User": "daemon", 
     "Volumes": null, 
     "WorkingDir": "/opt/docker" 
    }, 
    "Created": "2015-01-13T05:25:38.467586784Z", 
    "DockerVersion": "1.4.1", 
    "Id": "ddbd5d3f52cc5fd41605c95e4525cd2f3e0808a3741b3f8d77f46f0661945f7b", 
    "Os": "linux", 
    "Parent": "abd65ce243a5b015bb49f3e958103a5cc0c5f14938df4e480ded25f3ecf878e7", 
    "Size": 0, 
    "VirtualSize": 390826666 
} 
] 
+1

Il tuo punto di accesso è corretto? Vedo '" Entrypoint ": [" bin/a3-write-back "],' dovrebbe essere/bin invece di bin? Puoi pubblicare il tuo Dockerfile? – user2915097

+0

Sì, ricorda che il tuo comando "bash" verrà interpretato dal tuo script di inserimento, che potrebbe essere il problema –

+0

Che aspetto ha bin/a3-write-back? Se si tratta di uno script bash, è il percorso corretto per lo script bash in alto? Un'altra cosa da provare è 'docker run -P mylocalimage/bin/bash' e vedere cosa succede da lì, dovresti avere una shell. – Michael

risposta

55

L'immagine è basata su busybox, che non dispone di una shell bash. Ha una shell a /bin/sh.

Quindi questo non funziona:

$ docker run -it busybox bash 
exec: "bash": executable file not found in $PATH2015/01/15 11:09:08 Error response from daemon: 
Cannot start container a5074af2f81f8cc1eb0076f4ec9ada5f87be1440006f54a9b06ab701fc60176a: exec: 
"bash": executable file not found in $PATH 

ma questo:

$ docker run -it busybox /bin/sh 
/# 

Ci possono essere ulteriori complicazioni dovute allo script entrypoint, ma si può sempre ignorare questo.

+1

Geezus Cristo mi ha preso per sempre. Grazie. Nota questo funziona solo su CMD per me –

Problemi correlati