LoginSignup
2
0

More than 5 years have passed since last update.

Beanstalk worker tierの 単一コンテナの Dockerを Docker for Macで起動するメモ

Posted at

Beanstalk worker tierの 単一コンテナの Dockerを Docker for Macで起動するメモ

  • Worker tierのサンプルアプリケーションを Macでいじりたかった

Docker for Macをインストール

  • Install Docker for Mac
    • Docker.dmgを実行して起動
  • brew install dockerや VirtualBoxインストールは不要

単一コンテナの Docker をダウンロード

ビルド

cd docker-singlecontainer-v1/

ls
# Dockerfile        Dockerrun.aws.json  application.py      cron.yaml

docker build .
# (略)

docker images
# REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
# (略)

docker ps
# CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS               NAMES
# (略)

docker run -i -t $(docker images -q | head -1)
# (略)
# IOError: [Errno 2] No such file or directory: '/tmp/sample-app/sample-app.log'

vi application.py 
vi Dockerrun.aws.json 
# "/sample-app" を削る

docker build .
# (略)

docker images
# REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
# (略)

docker ps
# CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS               NAMES
# (略)

docker run -i -t $(docker images -q | head -1)
Serving on port 8000...

ログイン

  • 別コンソールより
cd docker-singlecontainer-v1/

ls
# Dockerfile        Dockerrun.aws.json  application.py      cron.yaml

docker ps
# CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS               NAMES
# (略)

docker exec -it $(docker ps -q | head -1) bash
# ログイン

root@xxxxxxxxxxxx:/# curl -XGET http://localhost:8000/
# <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
# <html>
# (略)

root@xxxxxxxxxxxx:/# exit
2
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
2
0