I have the next dockerfile:
FROM ubuntu:16.04
RUN apt-get update && apt-get upgrade -y && apt-get install -y apache2 mysql-server mysql-client
After, Docker build asking me the password root:
While not mandatory, it is highly recommended that you set a password for the
MySQL administrative "root" user.
If this field is left blank, the password will not be changed.
New password for the MySQL "root" user:
I enter the password, but, simply it stays in that state.
Can I install mysql this way?, I do not want to install it automatically
Just in case sendarle's answer was not very clear, add environment DEBIAN_FRONTEND such as shown below to your Dockerfile:
The accepted answer may be true in some abstract sense, but it's completely irrelevant to the matter at hand. You need a way to specify the password statically. And unless you are using the official image, you'll need that whether or not you follow the "one process, one container" dogma.
The answer here tells how, but it leaves out a key setting: you still have to tell
debconf
to use theNoninteractive
front-end, as described here.Here's an example of a working
Dockerfile
based on the above.This is not too terribly different from what the official
Dockerfile
does -- though they handle the actual password config somewhat differently.Some people have had success by setting the DEBIAN_FRONTEND environment variable to
noninteractive
, like so:However, that doesn't seem to work in all cases. Using
debconf
directly has proven more reliable for me.Docker way is "one container for one process". You need one container for apache and one for mysql. You can use official php image and official mysql image
for linking the containers i recommend use docker-compose