2

I am trying to run

$ apk add pkg

in an alpine linux based container that isn't starting up.

Can anyone tell what is wrong with the following commands.

$ 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]
desertnaut
  • 57,590
  • 26
  • 140
  • 166
user674669
  • 10,681
  • 15
  • 72
  • 105

1 Answers1

3

Your last attempt was almost correct syntax. You just need to remove the quotes around the arguments.

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
Shashank V
  • 10,007
  • 2
  • 25
  • 41