So I have a project I’m working on with some friends on Github. I want automatically restart/recreate (shoudn’t matter which of both) the container when someone pushs or merges on github. There for i use the portainer recreation webhook, which automatically deletes, pulls the image and recreates the container. The problem is, that the static ip i gave the container on creation is not adopted to the new container (normaly it should, there also exists an issue on their github project, which describes my problem). The only workaround i found is downgrading. I need the static ip for a nginx reverse proxy, which also runs in a container, connected to the same network. Do you know of any alternatives to the portainer recreation webhook, as a restart of the container would be suffice? Or how to handle shuffling ips in a nginx container?

  • hawkwind@lemmy.management
    link
    fedilink
    arrow-up
    2
    ·
    2 years ago

    Pretty vague on the details. I’m not familiar with portainer. Is this a public ip that is assigned or one you want to have the same internally to the containers?

    • ProgramPhoenixOPM
      link
      fedilink
      arrow-up
      2
      ·
      2 years ago

      they are all connected to a internal docker network. The ip only matters to my nginx container, which is the only container connected through port bindings. I run on creation something like this: docker run -d --network nginx-bridge --ip 172.172.0.140 ---name main node:latest /project/startup.sh but portainer calls on recreation this: docker run -d --network nginx-bridge ---name main node:latest /project/startup.sh

      • hawkwind@lemmy.management
        link
        fedilink
        arrow-up
        1
        ·
        2 years ago

        Ok. I did a little reading and I actually have used portainer, I just forgot, but not how you are using it. I can’t offer you a quick fix, but based on some assumptions I can offer some unsolicited advice.

        It looks like you want a CI/CD framework. What you’re doing sounds pretty straightforward and almost all projects are using some kind of automated tooling for this that gives you the flexibility you’re looking for.

        Everything you want your build to do and be, minus secrets, should be in the repo.

        • ProgramPhoenixOPM
          link
          fedilink
          arrow-up
          2
          ·
          2 years ago

          it should only be a personal state of the art preview thing. a complete ci/cd would may be a overkill

  • ProgramPhoenixOPM
    link
    fedilink
    arrow-up
    1
    ·
    2 years ago

    Update: i solved the problem by using hostnames, inside the nginx container you can use the name of the other container as hostname and it will be resolved automatically