PLCNEXT#Let’s try to use Docker,Podman in PLCNEXT AXCF 2152

Podman and Docker are both Container Runtime for creating, managing, and running containers, and podman has been installed by default since AXCF 2152 is firmware 2023.0.

This article describes how to install Docker and podman in AXCF 2152.

Let’s start!

Basic Setup

Check SD Card

Go to Web Server and click Security>SD Card.

Check the Support external SD Card checkbox and confirm that the message “SD card support is activated” appears in the Information section.

root password setup

Set the Password of the root with the sudo passwd root command.

admin@axcf2152:~$ sudo passwd root

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

Password: 

Configure new password

Enter the new password

New password:
Retype new password:
passwd: password updated successfully
admin@axcf2152:~$ 

Login with root

Root Login with the su command.

admin@axcf2152:~$ su
Password:
root@axcf2152:/opt/plcnext/# 

Check with Internet

Ping 8.8.8.8 to check if AXCF 2152 is connected to the Internet.

root@axcf2152:/opt/plcnext/# ping google.com
PING google.com (142.251.222.46): 56 data bytes
64 bytes from 142.251.222.46: seq=0 ttl=117 time=4.785 ms
64 bytes from 142.251.222.46: seq=1 ttl=117 time=4.728 ms
64 bytes from 142.251.222.46: seq=2 ttl=117 time=4.470 ms
64 bytes from 142.251.222.46: seq=3 ttl=117 time=4.273 ms

Play with Docker

Here is how to install Docker on the AXCF 2152.

Clone from Github

Clone /PLCnext/Docker_GettingStarted.git from Github to the CPU.

root@axcf2152:/opt/plcnext/# git clone https://github.com/PLCnext/Docker_GettingStarted.git
Cloning into ‘Docker_GettingStarted’…
fatal: unable to access ‘https://github.com/PLCnext/Docker_GettingStarted.git/’: SSL certificate problem: certificate is not yet valid

If Error

If a certificate is not yet valid error occurs, go to Configuration>Data and Time to correct the CPU time.

By default, no NTP Server is created.

Now we can synchronize time as well.

Reference Link

Please reference to this link:

PLCNEXT#SSL Certificate problem cerificate is not yet valid

Try Again

After you configured the time, you can clone the git without error.

root@axcf2152:/opt/plcnext/# git clone https://github.com/PLCnext/Docker_GettingStarted.git
Cloning into ‘Docker_GettingStarted’…
remote: Enumerating objects: 524, done.
remote: Counting objects: 100% (524/524), done.
remote: Compressing objects: 100% (247/247), done.
remote: Total 524 (delta 271), reused 470 (delta 223), pack-reused 0
Receiving objects: 100% (524/524), 967.58 KiB | 1.86 MiB/s, done.
Resolving deltas: 100% (271/271), done.

Change Rights

Change the Docker_GettingStarted permissions so that they can be executed.

root@axcf2152:/opt/plcnext/Docker_GettingStarted# chmod +x setup.sh
root@axcf2152:/opt/plcnext/Docker_GettingStarted# 

Run setup.sh

Lauch . /setup.sh to start Setup.

root@axcf2152:/opt/plcnext/Docker_GettingStarted# ./setup.sh
Please choose your container runtime:
      Install balenaEngine(recommend): 1
      Install Docker: 2
      Cancel installation: [C]ancel

Choose Docker

“Which do you want to install?” is asked and  Enter 2 and select Docker.

root@axcf2152:/opt/plcnext/Docker_GettingStarted# ./setup.sh
Please choose your container runtime:
      Install balenaEngine(recommend): 1
      Install Docker: 2
      Cancel installation: [C]ancel
      2 

Confirm

“Do you want to install docker-compose?”  is asked and please enter yes.If the installation is successful, you will get a message “Docker installation successful!”

If the installation is successful.

Do you wish to install docker-compose?
      yes
Starting Docker installation…
Connecting to download.docker.com (13.249.167.90:443)
wget: note: TLS certificate validation not implemented
saving to ‘docker-19.03.8.tgz’
docker-19.03.8.tgz    29% |****************************

Connecting to download.docker.com (13.249.167.90:443)
wget: note: TLS certificate validation not implemented
saving to ‘docker-19.03.8.tgz’
docker-19.03.8.tgz   100% |************************************************************************************************************************************************************| 55.6M  0:00:00 ETA
‘docker-19.03.8.tgz’ saved
docker/docker
docker/docker-proxy
docker/containerd
docker/ctr
docker/runc
docker/docker-init
docker/dockerd
docker/containerd-shim
Adding system startup for /etc/init.d/docker.
Starting Docker: docker.
Starting docker-compose installation…
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 –:–:– –:–:– –:–:–     0
100 20.7M  100 20.7M    0     0  4317k      0  0:00:04  0:00:04 –:–:– 4876k
        Docker installation successful!

Try Docker

Run the docker command in Terminal and if you see the output, it is OK.

root@axcf2152:/opt/plcnext/Docker_GettingStarted#docker

Usage:  docker [OPTIONS] COMMAND

A self-sufficient runtime for containers

Options:
      –config string      Location of client config files (default “/home/root/.docker”)
  -c, –context string     Name of the context to use to connect to the daemon (overrides DOCKER_HOST env var and default context set with “docker context use”)
  -D, –debug              Enable debug mode
  -H, –host list          Daemon socket(s) to connect to
  -l, –log-level string   Set the logging level (“debug”|”info”|”warn”|”error”|”fatal”) (default “info”)
      –tls                Use TLS; implied by –tlsverify
      –tlscacert string   Trust certs signed only by this CA (default “/home/root/.docker/ca.pem”)
      –tlscert string     Path to TLS certificate file (default “/home/root/.docker/cert.pem”)
      –tlskey string      Path to TLS key file (default “/home/root/.docker/key.pem”)
      –tlsverify          Use TLS and verify the remote
  -v, –version            Print version information and quit

Management Commands:
  builder     Manage builds
 config      Manage Docker configs
  container   Manage containers
  context     Manage contexts
  engine      Manage the docker engine
  image       Manage images
 network     Manage networks
  node        Manage Swarm nodes
  plugin      Manage plugins
 secret      Manage Docker secrets
 service     Manage services
  stack       Manage Docker stacks
  swarm       Manage Swarm
 system      Manage Docker
  trust       Manage trust on Docker images

Install Node-red

Finally, this command installs Node-red.

docker run -it –restart unless-stopped -p 1880:1880 –network=host –privileged –name=mynodered nodered/node-red

root@axcf2152:/opt/plcnext/Docker_GettingStarted# docker run -it –restart unless-stopped -p 1880:1880 –network=host –privileged –name=mynodered nodered/node-red

Unable to find image ‘nodered/node-red:latest’ locally
latest: Pulling from nodered/node-red
a6b45ace95f4: Pull complete
fda70e3c8913: Downloading [=================>                                 ]  11.84MB/34.23MB
dc0281435920: Download complete
67d57a1ee6d6: Download complete
8a47ee1d653d: Download complete
8b31a1a18921: Download complete
f8cb693e313b: Downloading [=================================>                 ]  6.232MB/9.406MB
4f4fb700ef54: Download complete
7bf0029a31f4: Download complete
37f666fd45d0: Download complete
85e2c14cc42d: Download complete
fcc9c721c42b: Waiting

———————————————————————
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the ‘credentialSecret’ option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
———————————————————————

16 Apr 11:06:23 – [info] Server now running at http://127.0.0.1:1880/
16 Apr 11:06:23 – [warn] Encrypted credentials not found
16 Apr 11:06:23 – [info] Starting flows
16 Apr 11:06:23 – [info] Started flows

Result

Node-red has been installed.

Play with podman

Here is how to use podman on AXCF 2152.

Reference Link

PLCNEXT#Firmware update

Check Version

First, check the podman Version; AXCF 2152 2023.0 has 4.0.3 installed.

root@axcf2152:/# podman version
Client:       Podman Engine
Version:      4.0.3
API Version:  4.0.3
Go Version:   go1.17.13
Git Commit:   62534053086fdeba7b93117e7c4dc6e797835a3e
Built:        Fri Apr  1 15:28:59 2022
OS/Arch:      linux/arm

Error

‘overlay’ is not supported Error is shown.

admin@axcf2152:/$ podman info                                       
Error: ‘overlay’ is not supported over overlayfs, a mount_program is required: backing file system is unsupported for this graph driver

Login as root

admin@axcf2152:/$su

mount it

sudo mount –make-rshared /

Check Again

root@axcf2152:/# podman info
host:
  arch: arm
  buildahVersion: 1.24.3
  cgroupControllers:
  – cpuset
  – cpu
  – cpuacct
  – blkio
  – memory
  – devices
  – freezer
  – net_cls
  – net_prio
  – pids
  – rdma

Install Node-red

root@axcf2152:/# podman run -it -p 1880:1880 -v node_red_data:/data –name mynodered nodered/node-red

Error?

This time /etc/containers/registries.conf Error happened.

Error: short-name “nodered/node-red” did not resolve to an alias and no unqualified-search registries are defined in “/etc/containers/registries.conf”

Check Container Files

I listed the contents of /etc/containers/ and sure enough, registry.conf was missing.

root@axcf2152:/# ls /etc/containers/*
/etc/containers/containers.conf  /etc/containers/registries.conf
/etc/containers/policy.json /etc/containers/storage.conf

Create Register Files

Create registries.conf file.

root@axcf2152:/# echoe “[registries.search]\nregistries = [‘docker.io’]” | sudo tee /etc/containers/registries.conf
[registries.search]
registries = [‘docker.io’]

Try again

Node-red is now available for download.

root@axcf2152:/# podman run -it -p 1880:1880 -v node_red_data:/data –name mynered nodered/node-red
Resolving “nodered/node-red” using unqualified-search registries (/etc/containers/registries.conf)
Trying to pull docker.io/nodered/node-red:latest…

Getting image source signatures
Copying blob a6b45ace95f4 done
Copying blob 67d57a1ee6d6 done
Copying blob fda70e3c8913 done
Copying blob 8a47ee1d653d done
Copying blob 8b31a1a18921 done

Commands

The commands for podman are basically the same as for Docker.

Check Running Container 

root@axcf2152:/# podman ps
CONTAINER ID  IMAGE       COMMAND     CREATED     STATUS      PORTS       NAMES

Check Stopped Container

root@axcf2152:/# podman ps -a
CONTAINER ID  IMAGE                              COMMAND     CREATED        STATUS                                  PORTS                   NAMES
5f5d44a040b4  docker.io/nodered/node-red:latest              3 minutes ago  Exited (130) 55 seconds ago (starting)  0.0.0.0:1880->1880/tcp  mynodered

Stop Container

root@axcf2152:/# podman stop 5f5d44a040b4
5f5d44a040b4

Start Container

root@axcf2152:/# podman start 5f5d44a040b4
5f5d44a040b4

Result

Done!Node-Red is running on podman.

Useful Link

https://nodered.jp/docs/getting-started/docker

https://kemasoft.net/?vm/podman_3.0

https://github.com/containers/podman/issues/9256

https://github.com/containers/buildah/issues/3726

https://www.plcnext.help/te/Service_Components/Using_OCI_containers.htm?rhhlterm=Docker

https://www.plcnext-community.net/forum/#/discussion/3231/node-red-for-plcnext-arm

https://hub.docker.com/r/nodered/node-red-docker

Footer_Basic

Please Support some devices for my blog

Amazon Gift List

Find ME

Twitter:@3threes2
Email:soup01threes*gmail.com (* to @)
YoutubeChannel:https://www.youtube.com/channel/UCQ3CHGAIXZAbeOC_9mjQiWQ

シェアする

  • このエントリーをはてなブックマークに追加

フォローする