LoginSignup
4

More than 5 years have passed since last update.

posted at

updated at

docker-compose で簡単! 最小お手軽構成のPythonテスト環境

お手軽Python環境を構築しました。

手順

  • docker-compose.yml ファイルを作る
  • test.pyみたいな適当なPythonファイルを作成する
  • docker-compose up -d
  • docker exec -it python /bin/bash
  • Pythonのコードを書いて色々テストや検証をする

サンプルコード

書いたコードはこちら

docker-compose.yml

docker-compose.yml
version: '3'
services:
  app:
    image: python:3.6
    volumes:
      - './:/var/www/html'
    container_name: python
    tty: true
    working_dir: '/var/www/html'

test.py

test.py
print('Hello world')

Githubに置きました。

ここにアクセス! tyamahori

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
What you can do with signing up
4