4

I have a strange issue. I have configured a SSH_USER on Jenkins and trying to deploy a simple docker-service with "deploy-over-SSH". Every time I deploy it Exits as below, and logs just says "Terminated"

$ docker ps -a
CONTAINER ID  IMAGE                      COMMAND               CREATED         STATUS                       PORTS                   NAMES
bea48e1ee755  localhost/my-image:latest  /bin/sh -c npm ru...  13 seconds ago  Exited (143) 13 seconds ago  0.0.0.0:6007->3000/tcp  my-cont
$ docker logs my-cont
Terminated

But if I try running manually on the same server with same SSH_USER, I am able to run docker container successfully.

docker run -d -it -p 6007:3000 --name my-cont my-image
$ docker ps -a
CONTAINER ID  IMAGE                      COMMAND               CREATED         STATUS          PORTS                   NAMES
nce48e1ee721  localhost/my-image:latest  /bin/sh -c npm ru...  21 minutes ago  21 minutes ago  0.0.0.0:6007->3000/tcp  my-cont

The script I am running over-SSH is very simple from Jenkins, I am passing the Port from Jenkins,

$ bash ./run.sh $Port
docker run -d -it -p $1:3000 --name my-cont my-image

Not sure , what is causing the issue.

Chandan
  • 5,376
  • 1
  • 4
  • 16
Krishna
  • 303
  • 2
  • 11
  • Are you sure that your manually executed container is not running when jenkins is trying to execute own container? Both containers want to publish port on the same port 6007, so they may block each other in this case. – Jan Garaj Dec 23 '20 at 04:56
  • Yea, I ensued that no ports are overlapped, Strange is that if I create a simple cronjob in same target server and run the script "run.sh" which fails like above with same error. Strange. – Krishna Dec 23 '20 at 06:52
  • OBSERVATION: the script with docker command as cronjob fails (looks Jenkins is not issue), $ docker -v podman version 1.9.3 $ podman -v podman version 1.9.3 $ cat /etc/redhat-release Red Hat Enterprise Linux release 8.2 (Ootpa) – Krishna Dec 23 '20 at 07:02
  • 1
    Try removing '-it' keys from your command. – anemyte Dec 23 '20 at 07:48
  • 2
    Upgrading the podman version to 'podman version 2.0.5' solved the issue. Strange but error or behaviour never given any clue on version. Thanks – Krishna Dec 23 '20 at 19:52

1 Answers1

1

As I mentioned in the comment, upgrading the version 'podman version 2.0.5' worked for me. The error or docker logs never gave me any hint, clue on version. But that was the solution. Thanks for your comments.

Krishna
  • 303
  • 2
  • 11
  • 1
    Podman is not docker, it's a competing product and docker has no control of the commands implemented by podman. – BMitch Dec 23 '20 at 21:15