The example in this repo demonstrates an issue with Docker I ran into: moby/moby#8903
The Dockerfile creates a user named builder and then invokes su builder -c dpkg-buildpackage in the CMD line.
The problem is that dpkg-package runs only half way through and then terminates the container.
The script wrapping the dpkg-package invocation does not continue to run.
Instead the container terminates unexpectedly.
dpkg-package should finish correctly (which would result in the sourcedeb files being generated correctly as well as some more output).
Furthermore the wrapping script would output several more messages.
git clone https://github.com/dirk-thomas/docker_issue.git /tmp/docker_issue
cd /tmp/docker_issue
docker build -t docker_issue .
docker run docker_issue
-
Drop into the interactive shell and call the exact same command there:
docker run -i -t docker_issue sh /tmp/sourcedeb/script/run.sh -
Invoke
dpkg-buildpackagewithrootinstead of the normal userbuilderby changing theCMDto:CMD ["sh", "-c", "/tmp/sourcedeb/script/run.sh"]