运行 "apk add" 命令在带参数的 docker 容器中
Running "apk add" command in a docker container with arguments
我正在尝试 运行
$ apk add pkg
在未启动的基于高山 linux 的容器中。
谁能告诉我以下命令有什么问题。
$ docker run --rm --entrypoint myimage:mytag 'apk add wget curl vim lynx'
docker: invalid reference format.
See 'docker run --help'.
$ docker run --rm myimage:mytag --entrypoint 'apk add wget curl vim lynx'
container_linux.go:262: starting container process caused "exec: \"--entrypoint\": executable file not found in $PATH"
docker: Error response from daemon: oci runtime error: container_linux.go:262: starting container process caused "exec: \"--entrypoint\": executable file not found in $PATH".
$ docker run --rm myimage:mytag --entrypoint '/sbin/apk add wget curl vim lynx'
container_linux.go:262: starting container process caused "exec: \"--entrypoint\": executable file not found in $PATH"
docker: Error response from daemon: oci runtime error: container_linux.go:262: starting container process caused "exec: \"--entrypoint\": executable file not found in $PATH".
$ docker run --rm --entrypoint "apk" myimage:mytag 'add wget curl vim lynx'
apk-tools 2.7.5, compiled for x86_64.
usage: apk COMMAND [-h|--help] [-p|--root DIR]
[-X|--repository REPO] [-q|--quiet]
您最后一次尝试的语法几乎是正确的。您只需要删除参数周围的引号。
docker run --rm --entrypoint apk myimage:mytag add wget curl vim lynx
ash-3.2$ docker run --rm --entrypoint apk alpine add wget curl vim lynx
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
(1/12) Installing ca-certificates (20191127-r2)
(2/12) Installing nghttp2-libs (1.40.0-r1)
(3/12) Installing libcurl (7.67.0-r0)
(4/12) Installing curl (7.67.0-r0)
(5/12) Installing gzip (1.10-r0)
(6/12) Installing ncurses-terminfo-base (6.1_p20200118-r4)
(7/12) Installing ncurses-libs (6.1_p2020
我正在尝试 运行
$ apk add pkg
在未启动的基于高山 linux 的容器中。
谁能告诉我以下命令有什么问题。
$ docker run --rm --entrypoint myimage:mytag 'apk add wget curl vim lynx'
docker: invalid reference format.
See 'docker run --help'.
$ docker run --rm myimage:mytag --entrypoint 'apk add wget curl vim lynx'
container_linux.go:262: starting container process caused "exec: \"--entrypoint\": executable file not found in $PATH"
docker: Error response from daemon: oci runtime error: container_linux.go:262: starting container process caused "exec: \"--entrypoint\": executable file not found in $PATH".
$ docker run --rm myimage:mytag --entrypoint '/sbin/apk add wget curl vim lynx'
container_linux.go:262: starting container process caused "exec: \"--entrypoint\": executable file not found in $PATH"
docker: Error response from daemon: oci runtime error: container_linux.go:262: starting container process caused "exec: \"--entrypoint\": executable file not found in $PATH".
$ docker run --rm --entrypoint "apk" myimage:mytag 'add wget curl vim lynx'
apk-tools 2.7.5, compiled for x86_64.
usage: apk COMMAND [-h|--help] [-p|--root DIR]
[-X|--repository REPO] [-q|--quiet]
您最后一次尝试的语法几乎是正确的。您只需要删除参数周围的引号。
docker run --rm --entrypoint apk myimage:mytag add wget curl vim lynx
ash-3.2$ docker run --rm --entrypoint apk alpine add wget curl vim lynx
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
(1/12) Installing ca-certificates (20191127-r2)
(2/12) Installing nghttp2-libs (1.40.0-r1)
(3/12) Installing libcurl (7.67.0-r0)
(4/12) Installing curl (7.67.0-r0)
(5/12) Installing gzip (1.10-r0)
(6/12) Installing ncurses-terminfo-base (6.1_p20200118-r4)
(7/12) Installing ncurses-libs (6.1_p2020