0

I couldn't find any solutions how to install mysql-5.6 in a docker container non-interactively. I found the following commands but they need user input:

# Update the repo list, execute :
wget http://repo.mysql.com/mysql-apt-config_0.2.1-1debian7_all.deb
dpkg -i mysql-apt-config_0.2.1-1debian7_all.deb

# Install
apt-get update
apt-get install mysql-server-5.6

Is there a better solution for non-interactive installation?

3 Answers 3

0

To install mysql56 with docker, you should really be using following:

MySQL is a widely used, open-source relational database management system (RDBMS).

Example:

$ docker run -d mysql:5.6
Unable to find image 'mysql:5.6' locally
Trying to pull repository docker.io/library/mysql ... 5.6: Pulling from library/mysql

23286f48d129: Pull complete 
cbee5247e891: Pull complete 
ed751d9dbe3b: Pull complete 
66a9f45a6f88: Pull complete 
f50b60617e9c: Pull complete 
c03269bf1687: Pull complete 
b14dd0099b51: Pull complete 
9acd57cae939: Pull complete 
3153a44fc5c3: Pull complete 
8b36d77ab230: Pull complete 
d574478a62d8: Pull complete 
ac82a224055d: Pull complete 
e3ce3c9ce67d: Pull complete 
57c790472a9d: Pull complete 
49772bf40877: Pull complete 
73f07a1d187e: Pull complete 
3446fa8ab4bb: Pull complete 
70c40ffe6275: Pull complete 
54672d2ddb6f: Pull complete 
Digest: sha256:03646869dfecf96f443640f8b9040fbde78a96269aaf47bbfbb505a4c1adcad9
Status: Downloaded newer image for docker.io/mysql:5.6

c6e1f30da1435f2c10e8cd2170d69e67d5cb8e307e1ce52af35506813537971a
$ 

OR, you can use Docker Compose as well.

3
  • I know, but I want nginx, php and mysql in one container and I use a nginx image, so I have to install mysql on my own.
    – tester
    Jun 2, 2016 at 19:16
  • 1
    @tester you need to get yourself more familiar with docker.
    – alexus
    Jun 2, 2016 at 19:37
  • 1
    I know docker is not meant to use everything in one container :-) But I have the requirement for that so I have to do it :-) Background: We have a server with little demo instances of a web application. We don't want to use 3 container (mysql, php, nginx) for every demo instance, as we have very many many demo instances.
    – tester
    Jun 3, 2016 at 4:42
0

I'm not sure if this works with dpkg, as I rarely use debian, but Unix in general has a method of making an interactive task scriptable:

shell#] cat > answers.txt << EOF
answer1
true
yes
no
answer10
EOF
shell#] interactive-command < answers.txt

Each line in the answers.txt file answers one question of the interactive setup process. You don't have to use the HERE document like in the example; vim, pico, nano, whatever can create the answer file.

In a Dockerfile you could ADD the answers.txt file, then RUN the command, piping the answers file to the stdin of the interactive command.

1
  • will use it for other installs for sure, thanks
    – ddavidad
    Oct 31, 2022 at 11:06
0

For the specific problem of, eg, apt-get install mysql-server-5.6 requiring interaction, you need to pass -y to apt-get.

however, you need a few other steps to have a fully customized docker image

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .