LoginSignup
11
9

More than 5 years have passed since last update.

curlコマンドを実行するだけのDockerfile

Last updated at Posted at 2018-07-14

Dockerfile

Dockerfile
FROM alpine:3.7
RUN apk update
RUN apk add curl
CMD curl -D - -s  -o /dev/null http://example.com

ビルド/実行

# ビルド
$ docker build -t curl .

# 実行
$ docker run curl
HTTP/1.1 200 OK
Server: nginx/1.13.8
Date: Sat, 14 Jul 2018 05:56:39 GMT
Content-Type: text/html
Content-Length: 14
Last-Modified: Sat, 14 Jul 2018 05:42:03 GMT
Connection: keep-alive
ETag: "5b498d2b-e"
Accept-Ranges: bytes

使い道

ECSでcurlを定期実行するために利用した。
URLごとにコンテナを管理するのは大変なので、タスクのスケジューリングコマンドの上書きを利用してURLを指定した。

curl,-D,-,-s,-o,/dev/null,http://xxx.xxx/xxxx

参考:
https://docs.aws.amazon.com/ja_jp/AmazonECS/latest/developerguide/ecs_run_task.html
コンテナ定義で ENTRYPOINT が指定されていない場合は、引用符のない文字列のコンマ区切りリストである必要があります。

11
9
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
11
9