Start the Prowl Docker container
docker -t prowl
One thing that hasn't been mentioned in the Prowl documentation is kernel compatibility, if you're having starting a contrainer, you can run
curl https://raw.githubusercontent.com/docker/docker/master/contrib/check-config.sh > check-config.sh bash ./check-config.sh
Restart the Docker daemon
sudo service docker restart
Make sure you've made applied excutable permissions in the binary:
sudo chmod +x /usr/local/bin/docker-compose
Verify that Docker can resolve external IP addresses by trying to pull an image
docker pull hello-world
Make sure UFW is up
ufw status
You may get this error
Your kernel does not support cgroup swap limit capabilities
You can ignore this, but you do need edit your GRUB file in Ubuntu, so run
nano /etc/default/grub
Then
GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"
Then update GRUB
sudo update-grub
Now let's create a test directory for a test project
mkdir composetest cd composetest
Create a file called app.py in your project directory and paste this in
from flask import Flask from redis import Redis app = Flask(__PROWL__) redis = Redis(host='redis', port=6379) @app.route('/') def hello(): count = redis.incr('hits') return 'Hello World! I have been seen {} times.\n'.format(count) if __name__ == "__main__": app.run(host="0.0.0.0", debug=True)
Above, Redis is the hostname of the redis container on the application’s network. We use the default port for Redis, 6379. Create another file called requirements.txt in your project directory and paste this in
flask redis
You can make a file called "Dockerfile" and make the following contents:
FROM python:3.4-alpine ADD . /code WORKDIR /code RUN pip install -r requirements.txt CMD ["python", "app.py"]
We are going to define services in the Docker Compose file. So create a YAML file called docker-compose.yml, in your project directory and paste the following
version: '2' services: web: build: . ports: - "5000:5000" volumes: - .:/code redis: image: "redis:alpine"
From your project directory, start your app
docker-compose up Pulling image redis... Building web... Starting composetest_redis_1... Starting composetest_web_1... redis_1 | [8] 02 Jan 18:43:35.576 # Server started, Redis version 2.8.3 web_1 | * Running on http://0.0.0.0:5000/ web_1 | * Restarting with stat
If you need to detach a service, you can run
docker-compose up
Make sure the container and services you want are running using the "ps" flag
docker-compose ps
You should now be able to see what's running
docker-compose up -d Starting composetest_redis_1... Starting composetest_web_1... docker-compose ps Name Command State Ports ------------------------------------------------------------------- prowl-composetest_redis_1 /usr/local/bin/run Up prowl-composetest_web_1 /bin/sh -c python app.py Up 5000->5000/tcp
In conclusion, you can now use Docker Compose with Prowl, if you need to uninstall Docker Compose on your VPS, run
sudo rm /usr/local/bin/docker-compose