Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
getting-started:ubuntu-docker-install [2017/07/25 08:45]
Elco Jacobs
getting-started:ubuntu-docker-install [2018/07/30 08:30] (current)
Bob Ubuntu guide with docker-compose
Line 7: Line 7:
 https://​docs.docker.com/​engine/​installation/​linux/​docker-ce/​ubuntu/​ https://​docs.docker.com/​engine/​installation/​linux/​docker-ce/​ubuntu/​
  
-==== Deploy the brewpi container ==== +Install docker-compose:​ 
-Get the latest Ubuntu based image brewpi image +
 <​code>​ <​code>​
-docker ​pull brewpi/​brewpi-ubuntu+sudo apt install python-pip 
 +pip install --user ​docker-compose
 </​code>​ </​code>​
-Deploy ​a new brewpi container. Modify ​the command below to to your liking, especially the port and the data location on the host (default is ''​~/​brewpi-data''​). + 
-We also mount ''/​etc/​localtime''​ and ''/​etc/​timezone''​ to the container, so it takes the time from the host.+==== Deploy the containers ==== 
 +Copy this code to a file called `docker-compose.yml
 <​code>​ <​code>​
-docker run -d --name brewpi -p 80:80 -v ~/​brewpi-data:/​data -v /​etc/​timezone:/​etc/​timezone -v /​etc/​localtime:/​etc/​localtime --restart always brewpi/​brewpi-ubuntu +version'​3'​
-</​code>​+
  
-Let's break that down to explain each part.+services: 
 +  brewpi: 
 +    image: brewpi/​brewpi-ubuntu 
 +    restart: always 
 +    privileged: true 
 +    volumes: 
 +      - ~/​brewpi-data:/​data 
 +      - /​etc/​timezone:/​etc/​timezone 
 +      - /​etc/​localtime:/​etc/​localtime 
 +    ports: 
 +      - "​80:​80"​
  
-^ Parameter ​              ^ Explanation ​                                                                                                              ^ +  portainer: 
-| -d                      | After starting the container, run it as daemon in the background. ​                                                        | +    ​image:​ portainer/​portainer 
-| --name brewpi ​          | Name the new container brewpi, modify this you are running multiple brewpi containers. ​                                   | +    ​restart:​ always 
-| -p 80:80                | Map port 80 of the container to port 80 of the host. If port 80 is in use, use a different port, for example 8000:​80. ​    | +    ​volumes
--v ~/brewpi-data:​/data  | Store data and settings in ~/brewpi-data on the host                                                                    | +      - /var/run/docker.sock:/var/run/docker.sock 
-|-v /​etc/​timezone:/etc/timezone <br> -v /​etc/​localtime:/​etc/localtime | Use timezone from the host                                                  | +    ​ports:​ 
---restart always ​       | Start on boot and always restart the container when it stops. ​                                                            | +      ​"​9000:​9000"​ 
-| brewpi/brewpi-ubuntu ​   | The image that is used. Use''​brewpi/​brewpi-raspbian''​ for the raspberry pi, ''​brewpi/​brewpi-ubuntu''​ for x64/x86 systems. ​    |+</code>
  
 +Open a terminal in the directory where you saved the file, and run the following command to get started:
  
-=== Connecting the BrewPi Spark via USB ===+<​code>​ 
 +docker-compose up -d 
 +</​code>​
  
-If you want to connect to the BrewPi ​Spark over USByou need to pass an extra argument to the container to forward ​the usb devicebefore '​brewpi/​brewpi-ubuntu'​.+This started ​the BrewPi ​containerand the Portainer management tool. 
 +To stop the containers againrun (still in the same directory):
  
-^ Parameter ​                             ^ Explanation ​                                                                                               ^ 
-| --device=/​dev/​ttyACM0:/​dev/​ttyACM0 ​    | Make the serial port device /​dev/​ttyACM0 available in the container ​                                       | 
- 
-The full command will then be: 
 <​code>​ <​code>​
-docker ​run -d --name brewpi -p 80:80 -v ~/​brewpi-data:/​data -v /​etc/​timezone:/​etc/​timezone -v /​etc/​localtime:/​etc/​localtime --restart always --device=/​dev/​ttyACM0:/​dev/​ttyACM0 brewpi/​brewpi-ubuntu+docker-compose down
 </​code>​ </​code>​
 +
 +You can of course modify the configuration to your liking.
 +
 +Let's break it down to explain each part:
 +
 +^ Parameter ​                              ^ Explanation ​                                                                                                             ^
 +| image: brewpi/​brewpi-ubuntu ​            | The type of docker container. ​                                                                                           |
 +| restart: always ​                        | Start on boot, and always restart the container when it stops. ​                                                          |
 +| privileged: true                        | The container is allowed to use the computer USB ports                                                                   |
 +| volumes: ~/​brewpi-data:/​data ​           | The container can now read and write all files in the brewpi-data directory. ​                                            |
 +| volumes: /​etc/​timezone:/​etc/​timezone ​   | The container will use the time and timezone settings from your computer. ​                                               |
 +| volumes: /​etc/​localtime:/​etc/​localtime ​ | The container will use your computer'​s current time.                                                                     |
 +| ports: 80:80                            | Map your computer'​s port 80 to port 80 on the container. 8000:80 would be port 8000 on your computer, 80 on container. ​   |
 +
  
 === Connecting the BrewPi Spark via WiFi === === Connecting the BrewPi Spark via WiFi ===
  
 This step requires that you both configure the BrewPi Spark itself and your docker instance so it can find your controller on the network. Please follow [[:​how-to-setup-wifi-on-the-brewpi-spark|this guide]] to configure both. Note that since you are running docker, expect the ''​config.cfg''​ to reside in ''​~/​brewpi-data/​settings/''​ or the folder you specified when ran your container. This step requires that you both configure the BrewPi Spark itself and your docker instance so it can find your controller on the network. Please follow [[:​how-to-setup-wifi-on-the-brewpi-spark|this guide]] to configure both. Note that since you are running docker, expect the ''​config.cfg''​ to reside in ''​~/​brewpi-data/​settings/''​ or the folder you specified when ran your container.
- 
-==== Install the portainer web interface to manage docker containers ==== 
-Portainer can make it easier to manage your running docker containers. You can install it with: 
-<​code>​ 
-docker run -d -p 9000:9000 -v /​var/​run/​docker.sock:/​var/​run/​docker.sock --restart always --name portainer portainer/​portainer 
-</​code>​ 
  
 ==== Use portainer to access the command line of the brewpi container ==== ==== Use portainer to access the command line of the brewpi container ====
-Try to load the portainer web interface: ''​localhost:​9000''​.+ 
 +After you've started the containers using docker-compose,​ you can load the portainer web interface: ''​localhost:​9000''​.
 It will ask you to set an admin password. Pick a password and set it up. Use it to log in on the next page.  It will ask you to set an admin password. Pick a password and set it up. Use it to log in on the next page.