When running the alpine docker container the first time and attempting an openssh install, the following happens:
ole@T:~$ docker run -it --rm alpine /bin/ash
/ # apk add openssh
WARNING: Ignoring APKINDEX.d3812b7e.tar.gz: No such file or directory
WARNING: Ignoring APKINDEX.bb2c5760.tar.gz: No such file or directory
ERROR: unsatisfiable constraints:
openssh (missing):
required by: world[openssh]
How should openssh be installed?
As the answer is already given but I will add up something.
In the new version, If you want to install something without caching things locally, which is recommended for keeping your containers small, include the
--no-cache
flag. Example:This is a small gain, it keeps you from having the common
rm -rf /var/cache/apk/*
at the end of your Dockerfile.Run
apk update
first. The below paste contains a complete example: