Docker Erste Schritte

Aus xinux.net
Zur Navigation springen Zur Suche springen

Initialer Start

  • mkdir -p /srv/apache2/htdocs
  • cd /srv/apache2
  • docker run -dit --name my-apache -p 9080:80 -v /srv/apache2/htdocs:/usr/local/apache2/htdocs/ httpd:2.4

Läuft mein Container

  • docker ps
CONTAINER ID        IMAGE               COMMAND              CREATED             STATUS              PORTS                  NAMES
fb2dcc90055e        httpd:2.4           "httpd-foreground"   19 minutes ago      Up 19 minutes       0.0.0.0:9080->80/tcp   my-apache

Stoppen

  • docker stop my-apache
my-apache

Starten

  • docker start my-apache
my-apache

Stoppen zum entfernen

  • docker stop my-apache
my-apache

Entfernen des Containers

  • docker rm my-apache
my-apache

Logging anschauen des Containers

  • docker logs my-apache
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
[Wed Mar 24 16:51:15.748143 2021] [mpm_event:notice] [pid 1:tid 140420729959552] AH00489: Apache/2.4.46 (Unix) configured -- resuming normal operations
[Wed Mar 24 16:51:15.748236 2021] [core:notice] [pid 1:tid 140420729959552] AH00094: Command line: 'httpd -D FOREGROUND'