Portainer is a management tool used to create and manage docker containers. When databases and file contents are copied to the NFS mounting point, you will have to access to the Portainer with your research user.
After authentication, your home page will be similar to this one:
On the left side, it will be a menu with different options. Go to “Stacks” and then click to “Add stack”:
Choose the web editor build method with a Stack name composed by your RESEARCH_GROUP-project_name:
The Docker Compose file should have this structure and must include all these parameters:
version: '3' # compose file version. it is only compatible from 3.0 to 3.3 services: # services definition http: # container name image: php:7.0-apache # docker image name from docker hub repository or your own image uploading to registry.sb.upf.edu deploy: placement: constraints: [node.role == worker] # it is essential this constraint definition. it is in charge of running containers on docker machines replicas: 1 resources: # resources definition: cpu, memory, container restart policy, etc limits: cpus: "0.5" memory: 256M restart_policy: condition: on-failure ports: - 8600:80 # port used for the container. we will provide you this number volumes: - volume_name:/var/www/html # "volume_name" is the network map name and "/var/www/html" is the container directory for html data restart: always networks: - project_name-network # "project_name-network" is the network used to connect the containers. replace "project_name" with the name of your project volumes: volume_name: driver: nfs driver_opts: share: 10.80.110.223:/RESEARCH_GROUP/docker/project_name/html # network map where the data will be stored. It is a persistent volume networks: project_name-network:
When you finish the compose file, click on "Deploy the stack". In this example, there is only one container that is pointing to a network share, but in the same stack we can have more than one container. If we have multiple containers will be defined in the same stack and can communicate with each other through the network defined in the stack.
At the final of this page you can download an example file (it has been tested):
Here, you have the Compose template. Since it is a .yml file extension, be careful with indents if you copy-paste some parts.
When you deploy a container, it is possible to obtain these states: