3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Dockerで簡単にApacheを立ち上げる

Posted at

設定ファイルを作成

docker-compose.yml
version: '3.3'

services:
  httpd:
    image: httpd:2.4
    ports:
      - '80:80'
    volumes:
      - ./htdocs:/usr/local/apache2/htdocs
      - ./conf:/usr/local/apache2/conf
index.html
<html>
<body>
<h1>Test Container</h1>
</body>
</html>

httpd.confをwindowsから操作できるようにコンテナからコピーをする。

docker run --rm --name httpd -d httpd:2.4
docker cp httpd:/usr/local/apache2/conf/ conf
docker rm -f httpd

ディレクトリ構成

C:.
│  docker-compose.yml
│
├─conf
│  │  httpd.conf
│  │  magic
│  │  mime.types
│  │
│  ├─extra
│
└─htdocs
        index.html

実行

docker-compose up
3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?