Instalación de OpenSSH en el contenedor Alpine Docker
Al ejecutar el contenedor alpine docker la primera vez e intentar una instalación de openssh, sucede lo siguiente:
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]
¿Cómo se debe instalar openssh?
30
2 answers
Ejecuta apk update
primero. La siguiente pasta contiene un ejemplo completo:
ole@T:~$ docker run -it --rm alpine /bin/ash
/ # apk update
fetch http://dl-4.alpinelinux.org/alpine/v3.3/main/x86_64/APKINDEX.tar.gz
fetch http://dl-4.alpinelinux.org/alpine/v3.3/community/x86_64/APKINDEX.tar.gz
v3.3.1-97-g109077d [http://dl-4.alpinelinux.org/alpine/v3.3/main]
v3.3.1-59-g48b0368 [http://dl-4.alpinelinux.org/alpine/v3.3/community]
OK: 5853 distinct packages available
/ # apk add openssh
(1/3) Installing openssh-client (7.1_p2-r0)
(2/3) Installing openssh-sftp-server (7.1_p2-r0)
(3/3) Installing openssh (7.1_p2-r0)
Executing busybox-1.24.1-r7.trigger
OK: 8 MiB in 14 packages
52
Author: Ole,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-02-29 00:05:03
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-02-29 00:05:03
Como la respuesta ya se ha dado, pero voy a sumar algo.
En la nueva versión, si desea instalar algo sin almacenar cosas en caché localmente, lo que se recomienda para mantener sus contenedores pequeños, incluya la bandera --no-cache
. Ejemplo:
apk add --no-cache openssh
Esta es una pequeña ganancia, evita que tengas el rm -rf /var/cache/apk/*
común al final de tu Dockerfile.
12
Author: Adiii,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-03-13 12:50:50
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-03-13 12:50:50