당사는 당사 웹페이지를 개선하기 위해 쿠키를 사용합니다. 당사의 쿠키 정책 을 읽으십시오.

NAS 145

Introducing Portainer

Use Portainer to pull images and deploy containers in ASUSTOR NAS

2024-10-25

COURSE OBJECTIVES

Upon completion of this course you should be able to:

  1. Use Portainer to pull images in Docker.
  2. Use Portainer to deploy containers in Docker.

PREREQUISITES

Course Prerequisites:

None

Students are expected to have a working knowledge of:

Docker / Image / Container


OUTLINE

1. Introducing Portainer

1.1 Installing Portainer

2. Managing a Local Docker environment

3. Pull Images of Docker

3.1 Search image path in Docker Hub

3.2 Pull Images

4. Deploying Containers

5. Remotely Access Deployed Containers

6. Upgrade image and update Container





1. Introducing Portainer

Docker does not have a GUI. To use Docker, an understanding of Docker's commands or refer to documentation to download, install and deploy images. Portainer is a powerful Docker management tool. Throughout the web interface, Portainer makes management of Docker apps and images more convenient for those not familiar with Docker commands, making it easier to use. Thousands of images from developers in Docker Hub can be easily deployed through Portainer. Portainer has a user-friendly interface that does not require typing commands into a command line interface. Simply download and deploy. Since Portainer is easy to use, apps can be directly and easily updated to the latest version while retaining the same settings. Portainer ensures that the possibilities on your ASUSTOR NAS are virtually limitless.



1.1 Installing Portainer

System requirements: AS31, 32, 40, 50, 51, 52, 53, 54, 61, 62, 63, 64, 70, Drivestor, Drivestor Lite, Drivestor Pro, Drivestor Pro Gen2, Lockerstor, Lockerstor Gen2, Lockerstor Gen3, Lockerstor Pro, Flashstor, Flashstor Gen2.


STEP 1

  • Using a web browser, log in to ADM using an account with administrator rights.
  • Select [ASUSTOR Apps] within App Central.
  • Click [Portainer CE] and press Install.


STEP 2

  • App Central will install Docker Engine first if not installed, and then install Portainer CE.
  • Locate Portainer CE on the desktop and click on it to open Portainer.
  • Please create a new administrator account in Portainer.




2. Managing a Local Docker environment

Set up a local Docker environment and initialize Portainer.

  • Select [Get Started].


  • Select Local in [Environments] settings of Portainer.
  • Within Environment details, key in the NAS IP as Public IP, click on [Update environment].




3. Pull Images of Docker

3.1 Search image path in Docker Hub

Portainer will pull Docker images from Docker Hub. Images with the same function or name may have different versions uploaded by different developers. To get the correct Docker image, please search the image name in Docker Hub first.

  • For example, searching wordpress in Docker Hub will bring up several results and the most popular version will be listed first. Click on the desired item to open the details page.


  • Find the image path on the Docker Pull Command field.



3.2 Pull Images


  • Log in to Portainer, select an Environment.


  • Click Images.


  • Set an image name in Docker Hub from the pull image page, click pull the Image.
  • Portainer will download the image with latest tag. To download other tags of images, please follow the instructions in Docker Hub.


To skip the previous steps in Docker Hub, enter the image name here, and click the search button on the right. A new tab will open and display search results in the Docker Hub.


  • The time required to pull an image will vary.


  • Completed downloads will be tagged as unused if image has not yet been deployed.




4. Deploying Containers

Containers can be deployed once an image has been downloaded. Once the container is successfully deployed, it can be used normally.


  • Click Containers.
  • Click Add container.


  • Set a name and an image of the Container.
  • Enable [Always pull the image] to pull a specified version or the latest version of a Docker image. By enabling this option, you can skip the previous steps of downloading a Docker image and instead enter the image name. To be sure of the correct name of an image, click Search to search for a Docker image on Docker Hub. If the docker image tag is not specified here, the latest tag will be used by default.


If a volume is needed to be configured in a docker container, a docker volume can be bound to a subfolder of a shared folder, so that the container's data can be saved on the NAS, and users can access the container data in ADM File Explorer.

  • Click [Advanced container settings] [Volumes] [+ map additional volume].
  • Under [container] field, enter the full path of the volume of the docker container and select [Bind].
    For example: WordPress's data folder "/var/www/html".
  • In [host] field, enter the full path of the NAS folder and select Writable or Read-only.
    For example: "/volume1/Docker/WordpressDK/data" on the NAS.


Docker will bind all the data in the html folder found in /var/www/ of the WordPress container to /volume1/Docker/WordpressDK/data on the NAS. The data is still saved on the NAS even if the container is removed.


  • [Publish all exposed network ports to random host ports] is recommended to be enabled.
  • Click Deploy the container.


  • Deployed containers will be automatically started. All deployed containers will be listed in the Container list and can be run.
  • The web UI can then be launched from deployed containers in a new browser tab.


Using Wordpress as an example, click on Published Ports in the list and Portainer will launch the Wordpress web UI in a new browser tab.
Note: Please refer to Managing a Local Docker Environment to setup Public IPs if IP is set to 0.





5. Remotely Access Deployed Containers

Ensure that that remote access is enabled before continuing. Please refer to NAS 221: Remote Access - Using EZ-Connect and NAS 224: Remote Access - Manual Connect.

Due to the web browser's improved security level, HTTPS remote connections are only allowed to web pages using DDNS URLs. The containers that do not support HTTPS connection and cannot import the ADM HTTPS certificate will not be supported for HTTPS remote connection to this container. Please refer to NAS 325: Introducing Reverse Proxies to try using ADM reverse proxy server for setting up the container remote HTTPS connection.

Portainer CE applied HTTPS connection by default after version 2.9.2, and it will automatically import the ADM certificate. After the ADM certificate is updated, if Portainer CE cannot be connected by the certificate is invalid or expired, please disable Portainer CE in App Central and re-enable it to import the updated ADM certificate.





6. Upgrade image and update Container

When the Docker image is updated to new version on Docker Hub, the latest version will also be updated. With the Container deployed by the latest version of the image, please refer to the followings steps to upgrade as the latest version of the image in Portainer.


  • Using Nextcloud as an example, select Nextcloud under Containers and stop it.


  • Click Nextcloud to update it.
  • Click on Recreate.


  • Enable [Pull latest image] and then click on Recreate.


  • The time required to recreate a container will vary.


  • The image used by Nextcloud is updated after recreate the container.
  • Click on Start to start the container.


  • The time required to complete the startup of the container will vary. Please wait for a while or click on Log to check if the container has been updated and successfully started.


  • Finally, remove from Images.

Note: If there is no image with tag [none] listed, indicating that this image file is the latest one and does not need to be updated.

Was this article helpful? Yes / No