无法运行apt-get命令以创建Docker映像

时间:2019-08-02 16:29:30

标签: docker-compose

I have centos Machine as a docker host and i was trying to create a container with UBUNTU
my docker compose file in docker host is as following

    来自ubuntu:latest     运行apt-get install -y git && \         易于清洁

When i was trying to build the image i am getting the following error
This is the section for building the image

[root@testcent image_creation]# docker build -t ubuntu_git/venkat_ubu_git .
Sending build context to Docker daemon 2.048 kB
Step 1/2 : FROM ubuntu:latest
 ---> 3556258649b2
Step 2/2 : RUN apt-get install -y git &&     apt-get clean
 ---> Running in 6b12dfaed5b8

Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package git
The command '/bin/sh -c apt-get install -y git &&  apt-get clean' returned a non-zero code: 100
[root@testcent image_creation]# </i>

$任何人都可以帮助我

1 个答案:

答案 0 :(得分:0)

通常,docker基础映像不支持没有更新命令直接安装软件包。检查并尝试以下是否适合您。

运行 apt-get update && apt-get install -y git && apt-get clean