gnzsnz / ib-gateway-docker

Docker image with IB Gateway/TWS and IBC
https://github.com/users/gnzsnz/packages/container/package/ib-gateway
MIT License
278 stars 53 forks source link

issue starting docker when userns remap active #200

Closed uplight-dev closed 1 week ago

uplight-dev commented 1 week ago

Before you submit this issue

If this is not an issue but a request for help, please post it on the discussions section. There is a search function that will help you find solutions to common problems.

Please make sure that you are running latest or stable for either ib-gateway or tws-rdesktop. Please run one of these as required

# ib-gateway
docker pull ghcr.io/gnzsnz/ib-gateway:latest
docker pull ghcr.io/gnzsnz/ib-gateway:stable
# tws-rdesktop
docker pull ghcr.io/gnzsnz/tws-rdesktop:latest
docker pull ghcr.io/gnzsnz/tws-rdesktop:stable

Please make sure that you are using the docker-compose.yml file provided as example, those files are tested and you should be able to get things working by using it.

The example .env file on README.md contains safe default values. Make sure you test the container using it as starting point.

If after all this work you are still facing problems, please open an issue.

Describe the bug

Getting this error when starting docker compose:

/home/ibgateway/scripts/common.sh: line 11: /home/ibgateway/ibc/config.ini: Permission denied

Seems that the files under /home/ibgateway are owned by user root.

total 428
algo-trader-ib-gateway-1  | drwxr-xr-x 3 root root   4096 Nov 12 13:15 .
algo-trader-ib-gateway-1  | drwxr-xr-x 1 root root   4096 Nov 12 13:18 ..
algo-trader-ib-gateway-1  | -rw-r--r-- 1 root root 119173 Aug 12 18:00 IBC.jar
algo-trader-ib-gateway-1  | -rw-r--r-- 1 root root  33096 Feb  8  2018 LICENSE.txt
algo-trader-ib-gateway-1  | -rw-r--r-- 1 root root    129 Feb 19  2018 README.txt
algo-trader-ib-gateway-1  | -rwxr--r-- 1 root root   1156 Jan 31  2024 commandsend.sh
algo-trader-ib-gateway-1  | -rw-r--r-- 1 root root  36379 Apr  4  2024 config.ini

To Reproduce

Steps to reproduce the behavior. Please include information related to docker, ex docker run command, .env file, docker-compose.yml.

Please provide the output of docker compose config MANDATORY ⚠️⚠️

` name: algo-trader services: ib-gateway: build: context: /home/light/algotrader/ibgateway-build.dkr/stable dockerfile: Dockerfile tags:

The container starts as expected.

Container logs

If applicable, add the container logs docker logs <CONTAINER> or docker compose logs to help explain your problem. MANDATORY ⚠️⚠️

Versions

Please complete the following information:

Additional context

Add any other context about the problem here.

What have you tried and failed.

My primary objective is to fix any bug on the container, ex Dockerfile, run.sh script, docker-compose.yml. Please don't expect upstream issues to be solved here (ex. IB gateway, IBC, etc)

uplight-dev commented 1 week ago

Actually I realized I've userns remap active in my docker configs.

/etc/subuid
light:1000:65536

/etc/docker/daemon.json
{
  "userns-remap": "light"
}

Is it possible to still make it work given this config?

uplight-dev commented 1 week ago

Seems I had to use 1001 as user/group id.

In docker-compose.yml file:

services:
  myservice:
    build:
      context: .
      args:
        USER_ID: 1001  # or any other user ID you want to pass
gnzsnz commented 1 week ago

both docker images (ib-gateway and tws-rdesktop) use UID/GID 1000:1000, based on your needs you can update that