2
3

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 5 years have passed since last update.

EC2でSwaggerを動かしてみる

Last updated at Posted at 2019-01-22

#環境準備
AWS EC2インスタンス作成(リポジトリにDockerが入っているAmazonLinuxAMIを選択)
#Dockerインストール

sudo yum update
sudo yum install -y docker
sudo service docker start

#DockerComposeインストール

curl -L "https://github.com/docker/compose/releases/download/1.9.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version

#SwaggerUIインストール

docker pull swaggerapi/swagger-ui

起動と確認

touch /openapi.yam ←API定義をこのファイルに書き込む
docker run -d -p 8081:8080 -e SWAGGER_JSON=/openapi.yaml -v /home/ec2-user/openapi.yaml:/openapi.yaml swaggerapi/swagger-ui
curl -X "http://127.0.0.1:8081"

#SwaggerEditorインストール

docker pull swaggerapi/swagger-editor

起動と確認

docker pull swaggerapi/swagger-editor
docker run -d -p 80:8080 swaggerapi/swagger-editor
curl -X "http://127.0.0.1:8081"

#あとがき
意外と簡単に導入できた。
中の仕組みをしらずとも動かせるのはいい。(勉強しろ)

2
3
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
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?