Skip to content
Maxime Burri edited this page Apr 12, 2017 · 22 revisions

Docker

Get started with Docker Docker hub

How-to: create a docker file launching a Python script

(parts from Python docker library readme)
In a directory, create files :

  • helloworld.py : print "Hello, World!"

  • requirements.txt (left empty)

  • Dockerfile

FROM python:2-onbuild
CMD [ "python", "./your-daemon-or-script.py" ]

Then build and run the Docker image:

$ docker build -t my-python-app .
$ docker run -it --rm --name my-running-app my-python-app

Important command line in the project

Build and run all services

  • In directory Dockers, make this commands in this order:
$ export TOKEN=yourgithubtoken
$ docker-compose up

Github retriever

  • build
$ docker build -t github_retriever_app .
  • run
$ docker run -e token=2je8dje98ekje0ekje0je... github_retriever_app `
  • run and export file
$ docker run -e token=... -v `pwd`/../csv_data:/usr/src/app/csv_data github_retriever_app

Jira retriever

  • build
$ docker build -t jira_retriever_app .
  • run
$ docker run jira_retriever_app`
  • run and export file
$ docker run -v `pwd`/../csv_data:/usr/src/app/csv_data jira_retriever_app

Docker commands

  • stop all containers: $ docker kill $(docker ps -q)
  • remove all containers: $ docker rm $(docker ps -a -q)
  • remove all docker images : $ docker rmi $(docker images -q)

Change project target

  • change github repo : $ export GITHUB_REPO="spring-projects/spring-amqp"
  • change jira project : $ export JIRA_PROJECT="AMQP"
  • change jira api server : $ export JIRA_SERVER="https://jira.spring.io"