Docker Alpine / bin / sh apk not found

I am creating a new Docker image with:

FROM alpine:3.4
RUN apk upgrade --update

However, his disclaimer of error:

[INFO] /bin/sh: apk: not found

This seems to work well on my local machine (Mac OSX), but when I try to create it on a Linux CentOS 7 computer, it fails.

+9
source share
3 answers

In the end, we updated our projects to use this Docker Maven plugin: https://github.com/fabric8io/fabric8-maven-plugin . There are no problems so far.

+1
source

- . , , , /sbin ( : , , CI).

command -v apk $PATH . command -v apk , find find / -name apk -type f -exec dirname "{}" ";" , $PATH

0

mmm apk , , Alpine:).

I recommend that you enter the container with

$ docker exec -it CONTAINER_ID_OR_NAME /bin/sh

and then

# which apk 

to find out if apk is present if the container is not running, you can do:

$ docker run --rm -it IMAGE_NAME /bin/sh

Here is an example of one of my Dockerfile

FROM alpine:edge
RUN apk add --no-cache gcc musl-dev python3 libxml2 libxml2-dev         libxslt libxslt-dev
RUN pip3 install --upgrade pip 
RUN pip3 install --upgrade pelican Markdown typogrify BeautifulSoup4 lxml
CMD "/bin/sh"

I also went into one of my containers, and I ran your command:

# apk upgrade --update
fetch http://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz
Upgrading critical system libraries and apk-tools:
(1/3) Upgrading apk-tools (2.6.7-r0 -> 2.6.8-r1)
-2
source

Source: https://habr.com/ru/post/1658946/


All Articles