Interactive Dockerfile Team

I am trying to automate the creation of a Docker image for development using the docker build with the corresponding Dockerfile . One of the scripts that I need to run on the RUN command requires the user to click and read their license agreement. So there are two questions:

  • Where is the output of all the RUN commands in the Dockerfile ?
  • What solution can interact with the above team? Right now, the docker build just gets stuck asking the user for input in an infinite loop.
+6
source share
2 answers

The output of the RUN commands is displayed in your terminal at build time. The Docker build process is completely non-interactive, so you should find some way to automatically accept the conditions (almost every piece of software allows this, think apt-get install -y... ) or using some kind of shell wizard to repeat the technique back to the process or something else ( Expect possible?).

+4
source

You can also do this in a few steps, starting from the Docker file with instructions to the interactive part. Then

docker build -t image1 .

Now just

docker run -it --name image2 image1 /bin/bash

you have a shell inside, you can do your interactive commands and then do something like

docker commit image2 myuser/myimage:2.1

Document for docker commit

https://docs.docker.com/engine/reference/commandline/commit/

you may need to specify a new CMD or ENTRYPOINT as indicated in the document

Lock container with new CMD and EXPOSE instructions

For example, some images of dockers using wine do this in several steps, install the wine, then launch and configure the software running in the wine, then docker commit

-one
source

Source: https://habr.com/ru/post/1012707/


All Articles