Deploy with Docker Compose¶
Docker is a virtualization software packaging applications and its dependencies in a virtual container that can run on any Linux server. It is available for a variety of the operating systems, e.g. Linux, macOS and Windows. For more information follow the link here.
NEST Desktop and NEST Simulator are prepared in different containers, but you can use docker-compose to start
multiple containers, e.g. NEST Desktop, NEST Simulator. Docker Compose needs the configuration file
(docker-compose.yml
).
Here, the guide shows you how to build containers with docker-compose
.
- Requirements:
Preparation¶
Prepare your local environment by installing Docker (if you have not installed it yet).
apt install docker-compose
Get the configuration file¶
The configuration file docker-compose.yml contains all setup steps executed by Docker. Fetch this file from GitHub:
wget https://raw.githubusercontent.com/nest-desktop/nest-desktop/main/docker/docker-compose.yml
It will pull images of NEST Desktop and NEST Simulator can be started from within the official NEST image (https://hub.docker.org/nest/nest-simulator).
Getting started¶
Build and start the NEST Desktop and NEST Simulator containers.
docker-compose up --build
NEST Desktop and NEST Simulator are now serving at http://localhost:54286
and http://localhost:52425
,
respectively. With Ctrl+C you can shutdown these services.
Configurations in docker-compose.yml
Here, you can find the details of the configuration file.
image |
Get docker image from Docker Hub |
container_name |
Set container name |
ports |
Bind host ports to container ports |
command |
Execute command on container start |
environment |
Set environment variables |
Alternatively, you can clone the source code so that you can change the Dockerfile and build custom docker images on your machine. For more information, visit the page https://github.com/nest-desktop/nest-desktop-docker.
Upgrade images¶
First stop the containers and shut down all services “nest-desktop” and “nest-simulator”.
docker-compose stop
docker-compose down
Then pull images from docker hub.
docker-compose pull
Afterwards, you can start the services and containers.
docker-compose up --no-start
docker-compose start
Useful commands¶
In the following you can find some useful commands for docker-compose.
List containers.
docker-compose ps
If there are no services (nest-desktop
and nest-simulator
) in the displayed list, it means that no containers
can be started. You can attach a container for services without starting it using --no-start
.
docker-compose up --no-start
Then start all services nest-desktop
and nest-simulator
as daemon.
docker-compose start
Stop all services, here nest-desktop
and nest-simulator
.
docker-compose stop
Shutdown all services, here nest-desktop
and nest-simulator
.
docker-compose down
Set environments¶
Custom port of NEST Simulator
For some reason the port 52425 is already occupied and thus starting the server instance of NEST Simulator might cause
conflicts. To resolve this issue, you can change the port to 54321
for NEST Simulator server instance.
You have to change three lines:
Set the environment
NEST_SIMULATOR_PORT: 54321
innest-desktop
service.Set the environment
NEST_SERVER_PORT: 54321
innest-simulator
service.Change the port binding to
"54321:54321"
innest-simulator
service.
An example configuration for docker-compose would be:
version: "3"
services:
nest-desktop:
image: nest/nest-desktop:4.0
environment:
NEST_SIMULATOR_PORT: 54321
ports:
- "54286:54286"
nest-simulator:
image: nest/nest-simulator:3.8
environment:
NEST_CONTAINER_MODE: "nest-server"
NEST_SERVER_PORT: 54321
ports:
- "54321:54321"
Acknowledgments¶
Thanks for the help:
Steffen Graber (Docker Hub for NEST Simulator)
Jochen Martin Eppler (API Server for NEST Simulator)