httpd@Docker

表題の通り、Dockerでhttpd(apache)を試す。

■ 環境

  • httpd 2.4.23
  • Docker for Mac 1.12.3
  • Mac OSX El Capitan

■ httpd

検索する。

$ docker search httpd
NAME    DESCRIPTION                      STARS     OFFICIAL   AUTOMATED
httpd   The Apache HTTP Server Project   800       [OK]
  :
$

公式のコンテナが存在するのでこれを使う。

library/httpd – Docker Hub
https://hub.docker.com/_/httpd/

$ docker pull httpd

起動してみる。

$ docker run -ti httpd
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 Nov 23 19:19:07.569728 2016] [mpm_event:notice] [pid 1:tid 139874477700992] AH00489: Apache/2.4.23 (Unix) configured -- resuming normal operations
[Wed Nov 23 19:19:07.574845 2016] [core:notice] [pid 1:tid 139874477700992] AH00094: Command line: 'httpd -D FOREGROUND'

versionは”2.4.3“であることがわかった。よく見るwarningのメッセージも出てる。

ローカルのブラウザからアクセスするには下記のようにする。

$ docker run -ti -p 8000:80 httpd

HTMLファイルを表示させるのであれば下記。

$ docker run -ti -p 8000:80 -v `pwd`:/usr/local/apache2/htdocs httpd

画面が表示された。

以上。

■ 関連

nginx@Docker

httpd@Dockerの起動方法