• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] Starting services/commands/scripts at startup of a container
#1
Hello,

how can I start services or commands at the startup of the container. I tried the command field in advanced options, but then the container doesn't start right.

Thanks in advance,

Jonas
  Reply
#2
What commands exactly to you mean? Portainer.io in the used version 1.12.4 on netPI does not offer you all docker commands.

The command field in portainer is this one "docker run [OPTIONS] IMAGE[:TAG|@DIGEST] [COMMAND] [ARG...]"

Thx
Armin
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#3
I tried to start a python script at the startup of the container. For that I put it in the rc.local but after every startup the script hasn't been executed. Then I tried to start it with the command field, but I don't know if it's possible to specify it there.

Thanks
Jonas
  Reply
#4
Hello Jonas,

you have to dig into the details of Docker technology to understand that rc.local and similar things do not work in a container. You have to take care of all such automatic start commands yourself.

Even if you specify a command like you tried the container will start the ENTRYPOINT command that has been specified by us when we have created the container image. All our example containers are starting the file entrypoint.sh that is in the /etc/init.d folder.

There are two methods to start you own commands:

1.) You make you own private container and do not use you example any more and make changes in the entrypoint.sh file in accordance to your ideas or use any other file when the container image is built.

2.) You use the existing container and specify a different Entry Point file in the web browser GUI when you Add a Container. Then this file is used instead of our default file entrypoint.sh.

Thx
Armin

You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#5
Hello Armin,

I fixed it by starting the python script inside the entrypoint.sh.
Thank you for your help.
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Profinet Startup Time Schranz 3 26 November-18th-2019, 03:22 PM
Last Post: Armin@netPI
  [SOLVED] activate LED1/2 with Node-RED + fieldbus nodes container Christian_Rau 6 90 October-21st-2019, 10:30 AM
Last Post: Armin@netPI
  Cannot start container Magnus 7 35 October-16th-2019, 01:00 PM
Last Post: Armin@netPI
  Generate VLAN interfaces in container FrankJacob 7 44 September-26th-2019, 03:19 PM
Last Post: Armin@netPI
  create container in Portainer v1.12.4 dcatteeu 2 23 September-9th-2019, 12:12 PM
Last Post: dcatteeu
  UMTS/LTE support via USB router/modem sticks in a container Armin@netPI 3 154 September-5th-2019, 02:07 PM
Last Post: Armin@netPI
  Exporting and importing container images Armin@netPI 0 23 August-23rd-2019, 10:39 AM
Last Post: Armin@netPI
  Ready-to-deploy: full featured Node-RED container Armin@netPI 5 77 July-25th-2019, 06:16 AM
Last Post: Armin@netPI
  New Container example "OPC UA server" Armin@netPI 0 17 April-12th-2019, 11:51 AM
Last Post: Armin@netPI
  Official Node-RED container Armin@netPI 0 19 April-5th-2019, 10:39 AM
Last Post: Armin@netPI

Forum Jump:


Users browsing this thread: 1 Guest(s)