Kommandos: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Jan (Diskussion | Beiträge) Die Seite wurde neu angelegt: „=Allgemeines= Alle Befehle haben die Struktur docker [Kommando] ==Run== Mit dem Kommando "run" werden Container in Docker ausgeführt Beispiel: docker…“ |
Thomas (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
||
| Zeile 16: | Zeile 16: | ||
*run --> Kommando zum ausführen eines Containers | *run --> Kommando zum ausführen eines Containers | ||
*ubuntu:14.04 --> | *ubuntu:14.04 --> | ||
=image laden= | |||
*root@tac:~# docker pull ubuntu:10.04 | |||
=image listen= | |||
*root@tac:~# docker images | |||
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE | |||
ubuntu 12.04 1f80e9ca2ac3 8 days ago 131.5 MB | |||
ubuntu 10.04 3db9c44f4520 10 months ago 183 MB | |||
=perstitent starten des containers mit dem namen humppa= | |||
*root@tac:~# docker run -t -i -p 880:80 --name humppa ubuntu:10.04 bash | |||
==in der maschine== | |||
*root@64f3a5281e7e:/# cat /etc/issue | |||
Ubuntu 10.04 LTS \n \l | |||
*root@64f3a5281e7e:/# exit | |||
*docker start -i ubuntu_persistent | |||
*root@tac:~# docker start -i humppa | |||
humppa | |||
*root@64f3a5281e7e:/# | |||
==apache2 installieren== | |||
*root@64f3a5281e7e:/# apt-get update | |||
*root@64f3a5281e7e:/# apt-get install apache2 | |||
*root@64f3a5281e7e:/# echo ServerName humppa >> /etc/apache2/apache2.conf | |||
*root@64f3a5281e7e:/# service apache2 restart | |||
==netstat listing== | |||
*root@64f3a5281e7e:/# netstat -lntp | |||
Active Internet connections (only servers) | |||
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name | |||
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN - | |||
==container verlassen== | |||
*root@64f3a5281e7e:/# exit | |||
=wieder auf dem host= | |||
*root@tac:~# | |||
=container anzeigen= | |||
*root@tac:~# docker ps -a | |||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES | |||
64f3a5281e7e ubuntu:10.04 bash 29 minutes ago Exited (130) 2 seconds ago humppa | |||
=container löschen= | |||
*root@tac:~# docker rm 64f3a5281e7e | |||
64f3a5281e7e | |||
=container verlassen= | |||
*CTRL+P danache CTRL+Q | |||
=container wieder betreten= | |||
*root@tac:~# docker attach 64f3a5281e7e | |||
=beispiele= | |||
*[[docker bind9]] | |||
*[[docker bind9 und ssh]] | |||
*[[mysql und mediawiki]] | |||
Version vom 5. März 2015, 09:06 Uhr
Allgemeines
Alle Befehle haben die Struktur
docker [Kommando]
Run
Mit dem Kommando "run" werden Container in Docker ausgeführt
Beispiel:
docker run ubuntu:14.04 /bin/echo 'Hallo Welt'
Syntax:
- docker -->
- run --> Kommando zum ausführen eines Containers
- ubuntu:14.04 -->
image laden
- root@tac:~# docker pull ubuntu:10.04
image listen
- root@tac:~# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE ubuntu 12.04 1f80e9ca2ac3 8 days ago 131.5 MB ubuntu 10.04 3db9c44f4520 10 months ago 183 MB
perstitent starten des containers mit dem namen humppa
- root@tac:~# docker run -t -i -p 880:80 --name humppa ubuntu:10.04 bash
in der maschine
- root@64f3a5281e7e:/# cat /etc/issue
Ubuntu 10.04 LTS \n \l
- root@64f3a5281e7e:/# exit
- docker start -i ubuntu_persistent
- root@tac:~# docker start -i humppa
humppa
- root@64f3a5281e7e:/#
apache2 installieren
- root@64f3a5281e7e:/# apt-get update
- root@64f3a5281e7e:/# apt-get install apache2
- root@64f3a5281e7e:/# echo ServerName humppa >> /etc/apache2/apache2.conf
- root@64f3a5281e7e:/# service apache2 restart
netstat listing
- root@64f3a5281e7e:/# netstat -lntp
Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN -
container verlassen
- root@64f3a5281e7e:/# exit
wieder auf dem host
- root@tac:~#
container anzeigen
- root@tac:~# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 64f3a5281e7e ubuntu:10.04 bash 29 minutes ago Exited (130) 2 seconds ago humppa
container löschen
- root@tac:~# docker rm 64f3a5281e7e
64f3a5281e7e
container verlassen
- CTRL+P danache CTRL+Q
container wieder betreten
- root@tac:~# docker attach 64f3a5281e7e