fazalfarhan01 / EarnApp-Docker

Containerized version of BrightData's EarnApp
https://hub.docker.com/r/fazalfarhan01/earnapp
42 stars 24 forks source link

containers generating new IDs #24

Closed munchkingawd closed 2 years ago

munchkingawd commented 2 years ago

First off let me start by saying thank you for the work you have done building this! I have been enjoying it very much.

I am pretty new to docker and such so I will do my best to explain the issue I am running into. I have been trying to run this as using docker-compose.yml and docker-compose up -d. Each 'app' under 'services' ends up generating a new ID (showid) upon restart. This is causing that each docker-compose down or restart of the the OS results in new IDs disconnecting the previous applications that were running and needing a new connection for the next.

my docker-compose.yml looks like this:

version: '3.3' services: eanapp01: image: fazalfarhan01/earnapp privileged: true volumes:

When running this .yml everything works fine and I can get the IDs without issue using docker-compose exec earnapp01 earnapp showid. As mentioned above the issue happens when there is any restart of the container the showid changes. I suspect this is due to a lack of understanding of how containers work in general but I would really appreciate any insight into how I can work around this :).

Thank you for any time you can provide to my question.

fazalfarhan01 commented 2 years ago

Hi @munchkingawd. Glad you liked the image. So the problem you are having is because there are a few errors in your compose file. You have syntax errors in the volumes part of the compose. And because of that there's no persistence in your container's storage and when the containers restarts, the data is wiped off.

Use the compose attached below, that'll fix your problem.

version: '3.3'
services:
    earnapp01:
        image: fazalfarhan01/earnapp
        privileged: true
        volumes:
            - /sys/fs/cgroup:/sys/fs/cgroup:ro
            - ./etc/01:/etc/earnapp
    earnapp02:
        image: fazalfarhan01/earnapp
        privileged: true
        volumes:
            - /sys/fs/cgroup:/sys/fs/cgroup:ro
            - ./etc/02:/etc/earnapp

As you can see, there are 2 different mount points for the 2 services. The reason being that if they have the same mount point, both will have the same persistent storage and same UUID.

Hope that helps. Don't mind closing the issue if it is resolved.