Search code examples
dockerfig

Why does fig try to 'echo' in my nearly-empty container?


I built a data volume container for Magento database and filesystem data. It doesn't need to do anything, so I made it barebones, just scratch with a couple of files and true-asm so it can run.

I then wrote a fig.yml file to put it together with mysql and php:5.4-apache to actually get a Magento instance going. But the second time I run fig up, the data container always fails to start. Here's a simplified example:

$ cat fig.yml 
magedata:
    image: kojiromike/magedata:empty
    command: /true-asm
$ fig up
Creating docker_magedata_1...
Attaching to docker_magedata_1
docker_magedata_1 exited with code 0
Gracefully stopping... (press Ctrl+C again to force)
$ fig up
Recreating docker_magedata_1...
Cannot start container c3b697f769301bb59a1ced05924990a68a02f1e554c9038f801574ed7c001aa1: exec: "echo": executable file not found in $PATH

Why is fig up trying to run echo when the command clearly says to run /true-asm?

Update (to answer commenter's questions)

There is no Dockerfile for this image, but the entrypoint can be set in fig.yml. If I do set it, fig appears to rewrite it to echo on the second run.

$ cat fig.yml 
magedata:
    image: kojiromike/magedata:empty
    command: /true-asm
    entrypoint: /true-asm
$ fig up
Creating foo_magedata_1...
Attaching to foo_magedata_1
foo_magedata_1 exited with code 0
Gracefully stopping... (press Ctrl+C again to force)
$ docker inspect --format='{{.Config.Entrypoint}}' $(docker ps -ql)
[/true-asm]
$ fig up
Recreating foo_magedata_1...
Cannot start container 8a54ac0e60953f1b4e2aaefe5702f04ed1953bed3eea1d8871441a989973fee5: exec: "echo": executable file not found in $PATH
$ docker inspect --format='{{.Config.Entrypoint}}' $(docker ps -ql)
[echo]

Solution

  • Because it needs to create an intermediate container in order to re-create the container with the same volumes_from and the same name. There is no way to remove the name and preserve the volumes_from.

    The intermediate container is created with echo

    https://github.com/docker/fig/pull/517