Table of Contents | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Prerequisites
A system with Docker or Docker Desktop installed
Precompiled .tar files for the Edge Manager version you prefer
Basic Installation
For this example, the assumptions are:
...
Code Block |
---|
docker load -i ./postgres_32.tar
docker load -i ./edgemanager3451_32.tar
docker network create autosol
docker run -d --name database --network autosol --restart always -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB="ASIServerDB" postgres_tar:latest
docker run -d --name edgemanager --network autosol -p 8080:8080 --restart always edgemanager_32:3.4.5.1 |
Note that with only port 8080 exposed for the Edge Manager container, only the web interface will be accessible. OPC UA and Priority Forward cannot be used.
Finding the Image and Container Names
To find the name of the images created by the docker load command, use:
Code Block |
---|
docker image ls |
To find all existing containers that are currently running, use:
Code Block |
---|
docker container ls |
The flag “-a” will show all containers regardless of if they’re running or stopped.
Advanced Installation Details
Optional Ports
The edgemanager container can be created with additional ports open. When opening ports in Docker, the format is: exposedPort:containerPort. For example, to have the Edge Manager website open on port 8880 use the flag “-p 8880:8080”
...
Priority Forward can use any port, but the default range is “-p 40000-40010:40000-40010”
Mounted Volumes
If you want data to be preserved when a container is recreated, you will need a mounted volume.
...
Code Block |
---|
docker volume create db-vol docker run -d --name database --network autosol --mount source=db-vol,target=/var/lib/postgresql/data --restart always -e POSTGRES_PASSWORD=postgres POSTGRES_DB="ASIServerDB" postgres_tar:latest |
Note |
---|
Warning: mounted volumes can preserve bad data as well as good; if a container is created with an error in database name or the wrong architecture .tar is restored, you will need to delete the volumes before a new container can succesfully successfully be run! |
Volumes can be listed with:
Code Block |
---|
docker volume ls |
The above volume can be removed with:
Code Block |
---|
docker volume rm db-vol |
Full Creation Example
Code Block |
---|
docker load -i ./postgres_32.tar docker load -i ./edgemanager3451_32.tar docker network create autosol docker volume create db-vol docker run -d --name database --network autosol --mount source=db-vol,target=/var/lib/postgresql/data --restart always -e POSTGRES_PASSWORD=postgres POSTGRES_DB="ASIServerDB" postgres_tar:latest docker run -d --name edgemanager --network autosol -p 8080:8080 -p 4840:4840 -p 40000-40010:40000-40010 --restart always edgemanager_32:3.4.5.1 |
Troubleshooting
If a Docker Container fails to run, or continually restarts, you can check the logs to see what might be happening.
Current status of all docker containers can be listed using:
Code Block |
---|
docker container ls -a |
Docker logs can be read using:
Code Block |
---|
docker logs containername |
Container “edgemanager” Crashes
Often the logs will indicate issues communicating with postgres. Confirm that the “database” container is running and contains a database named “ASIServerDB”. You can access the postgres container using ‘exec’ to enter the terminal
Code Block |
---|
docker exec -it database bash
psql -U postgres -d postgres
CREATE DATABASE “ASIServerDB”;
\q
exit |
Container “database” Crashes
The .tar of postgres that we include is a snapshot that may not work with all environments. If the container can’t continue running and the log contains errors like:
Code Block |
---|
popen failure: Cannot allocate memory
initdb: error: program "postgres" is needed by initdb but was not found in the same directory as "/usr/lib/postgresql/15/bin/initdb" |
Then the .tar may not be compatible with your system. Start by removing the container, image, (and volume if used):
Code Block |
---|
docker container rm database
docker image rm postgres_imagename
docker volume rm db-vol |
From here you can collect the precompiled for the correct architecture and try again.
Alternately, if you have internet access, you can recreate the docker container from Dockerhub:
Code Block |
---|
docker run -d --name database --network autosol --restart always -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=”ASIServerDB” postgres |
In some cases, you may need to manually specify the Postgres build. For example, on a Debian 9 machine:
Code Block |
---|
docker run -d --name database --network autosol --mount --restart always -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=”ASIServerDB” postgres:11.16-stretch |