I have a Jenkins server with Amazon EC2 Container Service Plugin installed. I am able to run a slave in ECS using example images like jenkins/jnlp-slave, but i want to use my own custom image that is present in AWS ECR repository as slave.
I have given the Image name as {ID}.dkr.ecr.us-east-1.amazonaws.com/python-slave:latest in ECS template in Configure system section,
But it is not able to bring up the slave. I went to the ECS cluster to see the cause of error, I can see in the task details that for ECR images it is trying to use the following command to bring up the containers,
-url http://xyz:8084/ b0a06a93aa32251b22ae3a1a198e2d8a2057f2808b7947ed612b9e1eebb109c5 'ecs java slave-4b15n'
It is failing with the error as,
Status reason CannotStartContainerError: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"-url\": executable file not found in $PATH": unknown
Command ["-url","http://xyz:8084/","b0a06a93aa32251b22ae3a1a198e2d8a2057f2808b7947ed612b9e1eebb109c5","ecs java slave-4b15n"]
Privileged false
But if i use example image like jenkins/jnlp-slave, it is using the following command and running fine
jenkins-agent -url http://xyz:8084/ bf8b42ab34d2691732026d8f454027c46d4ddaf9e9a7abc5af9c1ce417facf7a 'ecs java slave-x6p3z'
I have tried to find out the exact reason for this behaviour but no luck. Is there anyway we can use ECR image as jenkins Slave using ECS plugin.