I want to configure a container with MySQL, thereafter I will add a java application to the container. But, I could not install MySQL-server inside the container.
here is my dockerfile:
FROM ubuntu:latest RUN apt-get -y update RUN apt-get -y install mysql-server --fix-missing --fix-broken EXPOSE 3306 CMD ["/usr/bin/mysqld_safe"]
I got the following error:
Errors were encountered while processing: /var/cache/apt/archives/mysql-server-5.5_5.5.44-0ubuntu0.14.04.1_amd64.deb E: Sub-process /usr/bin/dpkg returned an error code (1) 2015/09/01 13:17:36 The command [/bin/sh -c apt-get -y install mysql-server –fix-missing –fix-broken] returned a non-zero code: 100
Advertisement
Answer
What’s probably happening is the apt-get install
is asking for input, and failing. What happens if you just run those commands interactively in the base container? e.g. launch a shell with docker run -ti --rm ubuntu:latest /bin/bash
One thing you can try is to use the DEBIAN_FRONTEND=noninteractive
environment variable, e.g.
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq install mysql-server