使用ubuntu构建dockerfile时无法安装libmysqlclient-dev软件包 [英] Can't install libmysqlclient-dev package when building dockerfile with ubuntu

查看:711
本文介绍了使用ubuntu构建dockerfile时无法安装libmysqlclient-dev软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Dockerfile上具有以下内容:

I have the following content on my Dockerfile:

FROM ubuntu:latest

RUN apt-get update
RUN apt-get install -y python-pip libmysqlclient-dev

我得到了这个输出:

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

奇怪的是,如果我在同一张图片上使用docker run运行同一件事,该命令将正常运行:

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]

使用Dockerfile时可能出什么问题了?

What could be wrong when using Dockerfile?

谢谢

推荐答案

在Dockerfile中使用default-libmysqlclient-dev

Use of default-libmysqlclient-dev in Dockerfile

代替了libmysqlclient-dev为我解决了这个问题.

instead of libmysqlclient-dev solved the issue for me.

这篇关于使用ubuntu构建dockerfile时无法安装libmysqlclient-dev软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆