无法使用mongodb创建docker映像

我正在尝试制作安装了mongo的docker映像。但是一切正常,除了没有安装mongo。我在Mac上运行docker。该图像包含ubuntu 16.0.4。这是dockerfile

FROM pytorch/pytorch:1.1.0-cuda10.0-cudnn7.5-devel
COPY requirements.txt /workspace/requirements.txt
RUN pip install -r /workspace/requirements.txt
RUN python -m spacy download en_core_web_sm
RUN [ "python","-c","import nltk; nltk.download('punkt')" ]

#show the ubuntu version
RUN cat /etc/*release

#mongo installation command

RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E52529D4
RUN bash -c 'echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 multiverse" > /etc/apt/sources.list.d/mongodb-org-4.0.list'
RUN apt-get update
RUN apt-get install libcurl3
RUN apt-get update
RUN apt-get install mongodb-org
RUN systemctl enable mongod.service
RUN systemctl start mongod.service
RUN mongo --version

在ubuntu版本命令后生成日志(在此之前,对于我的问题而言这并不重要)

Step 6/15 : RUN cat /etc/*release
 ---> Running in 24782e276d20
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.6 LTS"
NAME="Ubuntu"
VERSION="16.04.6 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.6 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial
Removing intermediate container 24782e276d20
 ---> 00320766b78e
Step 7/15 : RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E52529D4
 ---> Running in 2ef9e4b20a91
Executing: /tmp/tmp.Z3Rrfg8aCv/gpg.1.sh --keyserver
hkp://keyserver.ubuntu.com:80
--recv
E52529D4
gpg: requesting key E52529D4 from hkp server keyserver.ubuntu.com
gpg: key E52529D4: public key "MongoDB 4.0 Release Signing Key <packaging@mongodb.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
Removing intermediate container 2ef9e4b20a91
 ---> 1fe0c89be2f0
Step 8/15 : RUN bash -c 'echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 multiverse" > /etc/apt/sources.list.d/mongodb-org-4.0.list'
 ---> Running in e33ec803a371
Removing intermediate container e33ec803a371
 ---> 97d0d4785341
Step 9/15 : RUN apt-get update
 ---> Running in 89127b3e0759
Ign:1 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 InRelease
Get:2 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB]
Get:3 http://archive.ubuntu.com/ubuntu xenial InRelease [247 kB]
Get:4 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 Release [3457 B]
Get:5 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Get:6 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 Release.gpg [801 B]
Get:7 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
Get:8 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [985 kB]
Ign:9 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64  InRelease
Ign:10 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64  InRelease
Get:11 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages [1558 kB]
Get:12 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64  Release [564 B]
Get:13 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64  Release [564 B]
Get:14 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64  Release.gpg [819 B]
Get:15 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64  Release.gpg [833 B]
Get:16 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0/multiverse amd64 Packages [10.1 kB]
Get:17 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages [12.7 kB]
Get:18 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [589 kB]
Get:19 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64  Packages [234 kB]
Get:20 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages [14.1 kB]
Get:21 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages [9827 kB]
Get:22 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [6281 B]
Get:23 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64  Packages [69.2 kB]
Get:24 http://archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages [176 kB]
Get:25 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [1363 kB]
Get:26 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages [13.1 kB]
Get:27 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [993 kB]
Get:28 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [19.3 kB]
Get:29 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [7942 B]
Get:30 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [8807 B]
Fetched 16.5 MB in 3s (4437 kB/s)
Reading package lists...
Removing intermediate container 89127b3e0759
 ---> 40e17fc965f5
Step 10/15 : RUN apt-get install libcurl3
 ---> Running in e8948beba790
Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
  libcurl3
0 upgraded,1 newly installed,0 to remove and 65 not upgraded.
Need to get 186 kB of archives.
After this operation,565 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libcurl3 amd64 7.47.0-1ubuntu2.14 [186 kB]
debconf: delaying package configuration,since apt-utils is not installed
Fetched 186 kB in 0s (1042 kB/s)
Selecting previously unselected package libcurl3:amd64.
(Reading database ... 12586 files and directories currently installed.)
Preparing to unpack .../libcurl3_7.47.0-1ubuntu2.14_amd64.deb ...
Unpacking libcurl3:amd64 (7.47.0-1ubuntu2.14) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Setting up libcurl3:amd64 (7.47.0-1ubuntu2.14) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Removing intermediate container e8948beba790
 ---> 61cba7cc1107
Step 11/15 : RUN apt-get update
 ---> Running in 5d705749b377
Ign:1 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 InRelease
Hit:2 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:3 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 Release
Hit:4 http://archive.ubuntu.com/ubuntu xenial InRelease
Hit:5 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:7 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
Ign:8 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64  InRelease
Ign:9 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64  InRelease
Hit:10 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64  Release
Hit:11 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64  Release
Reading package lists...
Removing intermediate container 5d705749b377
 ---> 587c1ad10364
Step 12/15 : RUN apt-get install mongodb-org
 ---> Running in 870304e0a384
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
  tzdata
The following NEW packages will be installed:
  mongodb-org mongodb-org-mongos mongodb-org-server mongodb-org-shell
  mongodb-org-tools tzdata
0 upgraded,6 newly installed,0 to remove and 65 not upgraded.
Need to get 74.3 MB of archives.
After this operation,272 MB of additional disk space will be used.
Do you want to continue? [Y/n] Abort.
The command '/bin/sh -c apt-get install mongodb-org' returned a non-zero code: 1

我唯一出错的错误是我在最后一行看到的味精,这并不能说明为什么安装不成功。此外,以下提示不会给我输入Y的任何机会。

Do you want to continue? [Y/n]

任何想法,我在做什么错了?

wawad1314 回答:无法使用mongodb创建docker映像

您必须像这样包含-y选项:

apt-get install -y libcurl3

apt-get install -y mongodb-org

或等价的:

apt-get install --yes libcurl3

apt-get install --yes mongodb-org
本文链接:https://www.f2er.com/3141932.html

大家都在问