Probleme bei der Installation von ping in docker
Ich versuche, dem Docker-Tutorial zu folgen, aber in einer virtuellen Maschine. Ich habe versucht, Ping im Ubuntu Docker Container mit dem Befehl
sudo docker run ubuntu apt-get install ping
Das Problem ist, dass Docker nichts installiert und die Antwort wie folgt gibt
$ sudo docker run ubuntu apt-get install ping
Reading package lists...
Building dependency tree...
Package ping is a virtual package provided by:
inetutils-ping 2:1.8-6
iputils-ping 3:20101006-1ubuntu1
E: Package 'ping' has no installation candidate
$
Das gleiche Problem tritt auf, wenn ich versuche, etwas zu installieren.
Das sind meine Bilder:
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
<none> <none> 3a28cc5bcc53 19 minutes ago 247.6 MB
baselDaemon latest 4e892058b0b2 4 days ago 204.4 MB
ubuntu 13.10 9f676bd305a4 2 weeks ago 178 MB
ubuntu saucy 9f676bd305a4 2 weeks ago 178 MB
ubuntu 13.04 eb601b8965b8 2 weeks ago 166.5 MB
ubuntu raring eb601b8965b8 2 weeks ago 166.5 MB
ubuntu 12.10 5ac751e8d623 2 weeks ago 161 MB
ubuntu quantal 5ac751e8d623 2 weeks ago 161 MB
ubuntu 10.04 9cc9ea5ea540 2 weeks ago 180.8 MB
ubuntu lucid 9cc9ea5ea540 2 weeks ago 180.8 MB
ubuntu 12.04 9cd978db300e 2 weeks ago 204.4 MB
ubuntu latest 9cd978db300e 2 weeks ago 204.4 MB
ubuntu precise 9cd978db300e 2 weeks ago 204.4 MB
learn/tutorial latest 8dbd9e392a96 10 months ago 128 MB
Auch wenn ich sudo docker run ubuntu apt-get install ping
Was ist das hier verwendete' ubuntu'?
Danke im Voraus.
4 answers
Nach
Package ping is a virtual package provided by:
inetutils-ping 2:1.8-6
iputils-ping 3:20101006-1ubuntu1
E: Package 'ping' has no installation candidate
Versuche es mit:
sudo docker run ubuntu apt-get install iputils-ping
Sie wählen ein 'ubuntu' mit repository: Tag anstelle von IMAGE im Befehl RUN
sudo docker run ubuntu:lucid command
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/techietown.info/template/agent.layouts/content.php on line 61
2014-12-16 18:05:13
Führen Sie apt-get update
einmal vor der Installation aus:
sudo docker run ubuntu apt-get update
Siehe Was macht sudo apt-get update
?
apt-get update
lädt die Paketlisten aus den Repositorys herunter und "updates" sie Informationen über die neuesten Versionen von Paketen zu erhalten und Ihre Abhängigkeiten.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/techietown.info/template/agent.layouts/content.php on line 61
2017-04-13 12:23:00
Ja schließlich müssen Sie über drei verschiedene Themen wissen:
- Andockfenster
- Ubuntu
- APT-repositories
So möchte ich Ubuntu in einem Docker-Container zum Laufen bringen:
docker run -i -t ubuntu:16.04 /bin/bash
In Anlehnung an die Empfehlungen von @michael_arf aktualisieren Sie Ihre APT-Repositorys so:
apt-get update
Wenn Sie dann zu @VTacius' Lösung zurückkehren, installieren Sie die IP-Dienstprogramme, die für den Ping-Befehl verantwortlich sind:
apt-get install iputils-ping
Dann sind die Dinge zu überprüfen arbeiten wie erwartet:
which ping
ping superuser.com
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/techietown.info/template/agent.layouts/content.php on line 61
2017-04-21 15:59:58
Hatte das gleiche Problem bei der Verwendung des Ubuntu 16.04-Images in Docker.
Die folgenden Schritte haben mir geholfen, dieses Problem zu lösen.
-
Melden Sie sich als Bash beim Docker-Container an
$ docker exec -it <conatiner id> bash
-
Führen Sie im Docker-Container die folgenden Befehle aus. Erstes update apt-get -
$ apt-get update
-
Zweite Installation iputils-ping
$ apt-get install iputils-ping
Das sollte funktionieren.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/techietown.info/template/agent.layouts/content.php on line 61
2019-12-17 10:25:46