Menu
e-lo
  • Home
    • Tech
    • Inspiration and about
  • Database
    • T-SQL
    • SQL Server quick
    • SQL server docs
    • MySql quick sheet
    • Postgre
    • InfluxDB
  • Programming
    • Automating the boring stuff
    • Python 101
    • Python Docs
    • Python Logging
    • cSharp Overview
    • Powershell Latest
    • Powershell 4 lang ref
    • MS Azure PS ref
    • MS Azure CLI ref
  • Azure
    • AZ-104-MS Azure Administrator 101 quick ref
    • AZ-104 Lab
    • MS Windows virtual machines in Azure
    • MS ARM Docs
    • MS ARM Tutorial
    • MS Deployment scripts (intern/extern)
    • ARM Quickstart
    • MS ARM templates 4h
  • Az Adm
    • AD 101
    • Governance and Compliance 102
    • Administration 103
    • Virtual Networking 104
    • Storage 107 (With table (NoSQL and more))
    • Virtual Machines 108
    • Azure Virtual Machines 101
    • Monitor VM (and market)
  • Linux
    • Top CMD’s
    • Useful CMD Linux
    • ss64 Linux
    • Ubuntu
    • 30 things Ubuntu 18.04
  • Zen
    • Not thinking about anything is Zen
e-lo

Docker-compose ubuntu

Posted on February 10, 2020February 12, 2020 by espenk

Install it from here, the two first lines

https://get.docker.com/

curl -fsSL https://get.docker.com -o get-docker.sh

sh get-docker.sh

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.

https://docs.docker.com/compose/

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:

https://github.com/spawnmarvel/test_docker

Compose file version 3 reference, Reference and guidelines:

https://docs.docker.com/compose/compose-file/

RSS Azure

  • Azure and HITRUST publish shared responsibility matrix January 14, 2021

RSS Python

  • PEP 651: Robust Stack Overflow Handling January 18, 2021

Cloud

ARM (8) azure (23) cmd (1) Django (4) Docker (1) e-lo (2) Flask (2) Github (9) Grafana (2) Information (1) Information Retrieval (11) JAVA (1) kivy (2) Kotlin (4) linux (11) mobile (2) Natural Language Prossesing (NLP) (2) Net.Core (1) Networking and Security (2) OPC (2) PEP8 (1) Philosophy (3) Python (41) Python Networking and Security (2) Reason (2) RMQ (2) Solr (11) Sql (10) VSC (1) Warframe (2) WMVARE (4) Zabbix (7)

Recent Posts

  • 1 TODO ARM Lab 105 MS (Deployment create a pipeline)
  • 2 TODO MS ARM Template 4h
  • TODO Cryptography with Python – Caesar Cipher
  • 3 TODO Udemy AZ-104 Microsoft Azure Administrator Exam Certification (Scott Duffy)
  • ARM Lab 104 MS (Deployment and more)

Archives

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
©2021 e-lo | Powered by WordPress & Superb Themes