Support #3560

Problems with Docker command run

Added by Vadim 4 months ago. Updated about 1 month ago.

Status:In ProgressStart date:06/02/2020
Priority:NormalDue date:
Assignee:Rafael% Done:

0%

Category:-
Target version:RapidDeploy - 5.0-FIX
Affects Version:5.0-FIX Additional version details:
Timesheet Code:

Description

Hello.

Faced with a new one problem when starting Docker container through Run Docker Command task.

I need to run container with lot of parameters that cannot be passed through Docker Start container task, so I need to use Docker Run.

I will attach log and You will see where the problem is.
Shortly, when I configure custom log acquisition plugin for container it cannot be started. Plugin command looks like:

--log-opt loki-url="http://analytics-dev.fltechnics.com:3100/loki/api/v1/push"

RapidDeploy cannot start container with such option. But when I do that directly on the same server - everything goes Ok. I attach a screenshot also. There You can see that container with the same options (I copied all data from RD log) starts without errors and runs.

This is critical error. Can You please check it as soon as possible?
Thank You.

Best regards,
Vadim.

PUTTY_gNJBuI72Cm.png (19.8 KB) Vadim, 06/02/2020 09:21 am

docker_command_fail.log (445 KB) Vadim, 06/02/2020 09:21 am

deployment_log.txt Magnifier (374 KB) Vadim, 08/03/2020 01:57 pm

History

#1 Updated by Rafael 4 months ago

  • Status changed from New to In Progress
  • Assignee set to Rafael
  • Target version set to 5.0-FIX

#2 Updated by Rafael 4 months ago

  • Status changed from In Progress to Feedback
  • Assignee changed from Rafael to Vadim

Hi Vadim,

Although I couldn't really find the reason, I found the problem and the solution.

The "Occam's razor" states that "the simplest solution is most likely the right one", right? Well, you just need to remove the double quotes from the URL. :-)

So instead of:

... loki-url="http://analytics-dev.fltechnics.com:3100/loki/api/v1/push" ...

Use:

... loki-url=http://analytics-dev.fltechnics.com:3100/loki/api/v1/push ...

The reason? I have no idea, because even the error message is very misleading, but it should work.

What I couldn't determine is if the Loki driver actually needs the quotes for some reason, but if that's the case, you should be able to use the "Command Runner" task with the following configuration:

Script And Args = /bin/sh,-c,/usr/bin/docker run -t -d -p 9090:9090 --name rapiddeploy --log-driver=loki --log-opt loki-url="http://somelokihost.com:3100/loki/api/v1/push" midvision/rd

Basically use commas only for the "/bin/sh,-c," prefix and the rest normally. We were probably doing something wrong before, but this way was working good for me.

Let me know any feedback on this!

Cheers!

Rafa

#3 Updated by Vadim about 1 month ago

Hi Rafael.

This one Your solution works. Everything is Ok now. And totally, I don't use quotes in Docker command tasks anymore and seems that it works Ok without those. But... Today I faced this problem again. I tried different variants and cannot fix the problem. Can You please help me? :)

My docker command is such:
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' document_management_service
(the last one is a container name).
Command should return container's IP address as string.
I run this in shell and it works perfectly. I run it from RapidDeploy project and it fails. With quotes or without. The same error each time: "Template parsing error: template: :1: unexpected unclosed action in range". The same error I get if pass command to the shell without quotes.

Can You please check this? :)
Thank You in advance!

Best regards,
Vadim.

#4 Updated by Rafael about 1 month ago

  • Status changed from Feedback to In Progress
  • Assignee changed from Vadim to Rafael

Also available in: Atom PDF