0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

docker-compose.ymlで通信確認用簡易HTTPサーバー

Last updated at Posted at 2025-09-12

docker-compose.yml

services:
  http-server:
    image: busybox
    container_name: http-server
    restart: unless-stopped
    init: true
    ports:
      - 80:80
    command: >
      sh -c "
      while true; do
        echo -e 'HTTP/1.1 200 OK\\r\\n\\r\\nYay!' | nc -l -p 80;
      done
      "
docker compose up -d
curl http://localhost/

Yay! が表示されます。

下記の参考資料を docker compose 化したものですが、元ネタは改行コードがLFになっているのでプロトコル違反となっています(正しくはCRLF)。

参考資料

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?