Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Anaconda docker composer example

Example of usage of anaconda with docker composer

First let's create a new directory called composertest and cd into it:

$ mkdir composertest
$ cd composertest

Then add all the files contained in this gist and run:

$ docker-compose up

The command above will build the web image, pull redis and start a new container with the recently builded web image with anaconda running on it and serving on port 19360

from flask import Flask
from redis import Redis
app = Flask(__name__)
redis = Redis(host='redis', port=6379)
@app.route('/')
def hello():
redis.incr('hits')
return 'Hello World! I have been seen {} times.'.format(redis.get('hits'))
if __name__ == '__main__':
app.run(host='0.0.0.0', debug=True)
version: '2'
services:
web:
build: .
ports:
- "5000:5000"
volumes:
- .:/code
depends_on:
- redis
anaconda:
image composertest_web
ports:
- "19360:19360"
volumes:
- /home/damnwidget/development/anaconda/anaconda:/opt/anaconda
depends_on:
- web
entrypoint: /opt/anaconda/anaconda_server/docker/start python 19360 docker /opt/anaconda
redis:
image: redis
FROM python:2.7
ADD . /code
WORKDIR /code
RUN pip install -r requirements.txt
CMD python app.py
@mbriceno

This comment has been minimized.

Copy link

commented Oct 5, 2017

what image should I use? because the example in the .yaml does not work when running docker-compose up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.