We use cookies to help us improve our webpage. Please read our Cookie Policy .

NAS 145

Introducing Portainer

Use Portainer to pull images and deploy containers in ASUSTOR NAS

2019-08-28

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:
N/A

Students are expected to have a working knowledge of:
Docker / Image / Container


OUTLINE

1. Installing Portainer

2. Managing a Local Docker environment

3. Pull Images of Docker

3.1 Search image path in dockerhub

3.2 Pull Images

4. Deploying Containers

5. Adding Endpoints

6. Remotely Access Deployed Containers

7. Upgrade image and update Container





1. Installing Portainer

STEP 1

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


Applicable Models: AS31, 32, 40, 50, 51, 61, 62, 63, 64 and 70.


STEP 2

  • App Central will install docker-ce first if not installed, and then install Portainer.
  • Locate Portainer on the desktop and click on it to open Portainer.
  • Please use the account information in App Central’s app description of Portainer to create a new administrator account in Portainer.
  • ASUSTOR also recommends changing the password of Portainer. Click on User within Settings to change it.





2. Managing a Local Docker environment

Set up a local Docker environment and initialize Portainer.

  • Select Local and then click on Connect.


  • Select Local in Endpoints settings of Portainer.
  • Within Endpoint details, key in the NAS IP as Public IP.




  • 3. Pull Images of Docker

    3.1 Search image path in dockerhub

    Portainer will pull Docker images from dockerhub. 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 dockerhub first.

  • For example, searching phpmyadmin in dockerhub 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

  • Click Images.
  • Set an image name in dockerhub 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 dockerhub.


  • 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.
  • Publish all exposed 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. Adding Endpoints

    Portainer is able to control Docker implementations in other NAS devices with docker-ce installed.

  • Click Endpoints.
  • Click on Add endpoint.


  • Set a name and URL of the endpoint, click on Add endpoint.


  • Click Home to browse different endpoints.
  • Click on an endpoint to operate that endpoint’s particular Docker implementation.




  • 6. 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.

  • Select Local under Endpoints.
  • Within Endpoint details, key in the NAS WAN IP or defined domain as Public IP. (ie: as6302.myasustor.com)


  • Click Images and then select an image to further check details.
  • The EXPOSE column within Endpoint details will display the default port. (Ex: 80/tcp for Nextcloud)


  • Map a fixed port number to avoid automatic modifications after rebooting the NAS or container. If a container has already been deployed, remove it and deploy it again with the fixed port number.

  • Using Nextcloud as an example, set port 32680 under host and 80 under container within Ports configuration.


  • Select Manual Connect within Settings.
  • Select EZ-Router and click on Define.
  • Select TCP. Key in 32680.
  • Remotely access Nextcloud by keying in the URL for your NAS followed by a colon and the port number. IE http://as6302.myasustor.com:32680




  • 7. 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 on Id of nextcloud:latest under Images.


  • Click on Pull from registry to pull current latest version from Docker Hub.


  • After the image file is downloaded, there are two versions of the nextcloud image in Image list, where the tag is modified to , which is the image of the previous version. The upgraded latest version is marked as "Unused".
    Note: If there are no two versions of the image listed, indicating that this image file does not have an updated version, please skip the following steps to restart the container directly.


  • Select Nextcloud under Containers, you will find that the image used by the original Nextcloud is no longer marked as nextloud:latest, click Nextcloud to update it.


  • Click on Duplicate/Edit.


  • Click on Deploy the container without modify original container settings, and click Replace in the Dialog to confirm that you want to replace the original Nextcloud container.



  • The image used by Nextcloud is updated as nextloud:latest after deploy the container.


  • Finally, remove from Images.


  • Was this article helpful? Yes / No