I have the following content on my Dockerfile:
FROM ubuntu:latest
RUN apt-get update
RUN apt-get install -y python-pip libmysqlclient-dev
And I got this output:
Step 4 : RUN apt-get install -y python-pip libmysqlclient-dev
---> Running in 2fb54b3107d4
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package libmysqlclient-dev
The command '/bin/sh -c apt-get install -y python-pip libmysqlclient-dev' returned a non-zero code: 100
The weird thing is that if I run the same thing using docker run
over the same image, the command works fine:
$ docker run -it --rm ubuntu bash
root@5f4d0083bd31:/# apt-get update && apt-get install libmysqlclient-dev
Get:1 http://archive.ubuntu.com/ubuntu xenial InRelease [247 kB]
Get:2 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial/main Sources [1103 kB]
Get:5 http://archive.ubuntu.com/ubuntu xenial/restricted Sources [5179 B]
Get:6 http://archive.ubuntu.com/ubuntu xenial/universe Sources [9802 kB]
Get:7 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages [1558 kB]
Get:8 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages [14.1 kB]
Get:9 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages [9827 kB]
Get:10 http://archive.ubuntu.com/ubuntu xenial-updates/main Sources [261 kB]
Get:11 http://archive.ubuntu.com/ubuntu xenial-updates/restricted Sources [1872 B]
Get:12 http://archive.ubuntu.com/ubuntu xenial-updates/universe Sources [137 kB]
Get:13 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [548 kB]
Get:14 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages [11.7 kB]
Get:15 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [459 kB]
Get:16 http://archive.ubuntu.com/ubuntu xenial-security/main Sources [60.7 kB]
Get:17 http://archive.ubuntu.com/ubuntu xenial-security/restricted Sources [1872 B]
Get:18 http://archive.ubuntu.com/ubuntu xenial-security/universe Sources [15.8 kB]
Get:19 http://archive.ubuntu.com/ubuntu xenial-security/main amd64 Packages [225 kB]
Get:20 http://archive.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages [11.7 kB]
Get:21 http://archive.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [76.9 kB]
Fetched 24.6 MB in 1min 26s (284 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libc-dev-bin libc6 libc6-dev libmysqlclient20 linux-libc-dev manpages manpages-dev mysql-common zlib1g-dev
Suggested packages:
glibc-doc man-browser
The following NEW packages will be installed:
libc-dev-bin libc6-dev libmysqlclient-dev libmysqlclient20 linux-libc-dev manpages manpages-dev mysql-common zlib1g-dev
The following packages will be upgraded:
libc6
1 upgraded, 9 newly installed, 0 to remove and 17 not upgraded.
Need to get 10.9 MB of archives.
After this operation, 35.3 MB of additional disk space will be used.
Do you want to continue? [Y/n]
What could be wrong when using Dockerfile?
Thanks
I ran into this problem with a debian container. What fixed it was installing each package with separate commands. So instead of
RUN apt-get install -y python-pip libmysqlclient-dev
do
RUN apt-get install -y python-pip
RUN apt-get install -y libmysqlclient-dev
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With