简体   繁体   English

入口点子句在 dockerfile 中不起作用

[英]Entrypoint clause not working in the dockerfile

I'm trying to build a container using this docker file我正在尝试使用此 docker 文件构建容器

FROM ubuntu:16.04

RUN apt-get update && apt-get install -y --no-install-recommends \
    python3.5 \
    python3-pip \

ENTRYPOINT ["/bin/bash"]

For some reason the ENTRYPOINT using ["/bin/bash"] is not being recognize.由于某种原因,使用["/bin/bash"]ENTRYPOINT未被识别。

When i build the container without the ENTRYPOINT i can run it with no problem using this command with the /bin/bash at the end当我在没有ENTRYPOINT的情况下构建容器时,我可以在最后使用 /bin/bash 的这个命令毫无问题地运行它

docker run -ti -d --name ubunto-teste_2 --rm ubuntu:16.04 /bin/bash

I'm learning linux and docker so i doesn't now much我正在学习 linux 和 docker 所以我现在不多

The error i'm getting is this one我得到的错误是这个

[+] Building 48.2s (5/5) FINISHED
 => [internal] load build definition from Dockerfile                                                                                       0.1s
 => => transferring dockerfile: 191B                                                                                                       0.0s
 => [internal] load .dockerignore                                                                                                          0.1s
 => => transferring context: 2B                                                                                                            0.0s
 => [internal] load metadata for docker.io/library/ubuntu:16.04                                                                            0.0s
 => CACHED [1/2] FROM docker.io/library/ubuntu:16.04                                                                                       0.0s
 => ERROR [2/2] RUN apt-get update && apt-get install -y --no-install-recommends     python3.5     python3-pip ENTRYPOINT ["/bin/bash"]   48.0s
------
 > [2/2] RUN apt-get update && apt-get install -y --no-install-recommends     python3.5     python3-pip ENTRYPOINT ["/bin/bash"]:
#5 0.893 Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [99.8 kB]
#5 0.899 Get:2 http://archive.ubuntu.com/ubuntu xenial InRelease [247 kB]
#5 1.724 Get:3 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [2051 kB]
#5 2.052 Get:4 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [99.8 kB]
#5 2.445 Get:5 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [97.4 kB]
#5 2.658 Get:6 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages [1558 kB]
#5 3.286 Get:7 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages [15.9 kB]
#5 3.289 Get:8 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [984 kB]
#5 3.368 Get:9 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [8820 B]
#5 6.859 Get:10 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages [14.1 kB]
#5 6.888 Get:11 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages [9827 kB]
#5 33.97 Get:12 http://archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages [176 kB]
#5 34.43 Get:13 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [2560 kB]
#5 41.23 Get:14 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages [16.4 kB]
#5 41.28 Get:15 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [1544 kB]
#5 45.48 Get:16 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [26.2 kB]
#5 45.55 Get:17 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [10.9 kB]
#5 45.57 Get:18 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [12.7 kB]
#5 45.66 Fetched 19.3 MB in 45s (429 kB/s)
#5 45.66 Reading package lists...
#5 46.60 Reading package lists...
#5 47.59 Building dependency tree...
#5 47.73 Reading state information...
#5 47.75 E: Unable to locate package ENTRYPOINT
#5 47.75 E: Unable to locate package [/bin
#5 47.75 E: Couldn't find any package by glob '[/bin'
#5 47.75 E: Regex compilation error - Unmatched [ or [^
#5 47.75 E: Couldn't find any package by regex '[/bin'
------
executor failed running [/bin/sh -c apt-get update && apt-get install -y --no-install-recommends     python3.5     python3-pip ENTRYPOINT ["/bin/bash"]]: exit code: 100

I think is has something to do with the end of line sequence我认为这与行序列的结尾有关

The backslash after python3-pip looks wrong to me. python3-pip之后的反斜杠在我看来是错误的。 It means that the line is being continued, which makes the word ENTRYPOINT part of the RUN command.这意味着该行正在继续,这使得单词ENTRYPOINT成为 RUN 命令的一部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM