- you'll need virtualbox:
brew cask install virtualbox brew install docker- install toolbox
- https://www.docker.com/docker-toolbox
- or with caskroom:
brew cask install dockertoolbox- if you get an error:
sudo chown -R <username>:staff ~/.docker
- if you get an error:
pop up the docker quickstart terminal. it'll start up the VM and you'll be all set up.
- it'll show text
docker is configured to use the default machine with IP 192.168.99.100==> remember that IP address
create file app.py
from flask import Flask
app = Flask(__name__)
@app.route('/')
def main():
return 'Hello World!'
if __name__ == '__main__':
app.run('0.0.0.0')and requirements.txt
flask==0.10.1
if you run python app.py locally you can visit localhost:5000 and you'll see "Hello world!".
- create a
Dockerfile.
FROM python:2.7
RUN mkdir /code
WORKDIR /code
ADD requirements.txt /code/
RUN pip install -r requirements.txt
ADD . /code/
EXPOSE 5000
now we run the app in docker.
docker build -t flaskapp .docker run -p 5000:5000 flaskapp python app.py- the app is now running on the VM. visit the app on the IP address from earlier, port 5000 (e.g.
192.168.99.100:5000)
all done.