Install it from here, the two first lines

curl -fsSL -o


docker –version

Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration. To learn more about all the features of Compose, see the list of features.

Compose works in all environments: production, staging, development, testing, as well as CI workflows. You can learn more about each case in Common Use Cases.

Now lets create a simpel python module and run it with docker and portainer.

Hm you might have to add your user or use sudo in order to get it to work.

espen@espen-UN65U:~/project2020/test$ sudo usermod -aG docker espen
espen@espen-UN65U:~/project2020/test$ sudo service docker stop
espen@espen-UN65U:~/project2020/test$ sudo service docker start
espen@espen-UN65U:~/project2020/test$ docker –version
Docker version 19.03.5, build 633a0ea838

espen@espen-UN65U:~/project2020/docker_test/test_docker$ sudo docker-compose up -d
Creating network “testdocker_default” with the default driver
Creating network “testdocker_data_network” with the default driver
Creating testdocker_python-test_1 …
Creating testdocker_portainer_1 …
Creating testdocker_python-test_1
Creating testdocker_portainer_1 … done

And then we are up and running with three containers, lets explain it now.

Here are the two containers with python and portainer, here you can view logs, stop, start, restart, inspect and more.

start it with:

sudo docker-compose up

python module is just looping and logging:

Change code:

sudo docker-compose down

Then, lets add “loop a bit more” to the output

sudo docker-compose up

Then the output is changed:

Structure of project, git code:

Compose file version 3 reference, Reference and guidelines: