Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Environ settings ignored by upstream docker service #317

Open
benfiedler opened this issue May 26, 2022 · 3 comments
Open

[BUG] Environ settings ignored by upstream docker service #317

benfiedler opened this issue May 26, 2022 · 3 comments
Labels

Comments

@benfiedler
Copy link

benfiedler commented May 26, 2022

My setup

Formula version: latest master

Versions reports (master & minion)

Salt Version:
Salt: 3004.1

Pillar / config used

docker:
  pkg: 
    docker:
      daemon_config:
        insecure-registries:
          - my.repo.local:5000
      environ:
        - HTTP_PROXY=http://my.proxy.local:3128/
        - HTTPS_PROXY=http://my.proxy.local:3128/
        - NO_PROXY="localhost,127.0.0.1,.local"
      use_upstream:
        repo
  wanted:
    - docker

Bug details

Describe the bug

Hi,

I have recently switched over to using this formula, and it seems to work great except for one thing:

In my testing across recent *nixes (Debian-11 / Ubuntu-20.04 / CentOS Stream-8), the environ_file is unutilized by upstream packages and ignored by the docker systemd service.

Steps to reproduce the bug

salt 'mydockerminion01' state.apply docker.software
salt 'mydockerminion01' cmd.run "docker pull nginx:latest"

mydockerminion01:
    Error response from daemon: Get "https://registry-1.docker.io/v2/": dial tcp 52.200.78.26:443: connect: connection refused

Expected behaviour

Docker should be pulling images using the proxy

Attempts to fix the bug

I have come up with a simple fix to the formula which if an environ is defined on *nix, opts to create a drop-in docker.service.d/override.conf using states.ini_manage which is simply:

[Service]
EnvironmentFile = {{ environ_file }}

Detected changes to the dropin file will do a systemctl daemon-reload and also restart the service.
I also fixed service.running to enforce changes to the environ file by restarting the docker service.

My fork with fixes:
benfiedler@b131392

Additional context

@benfiedler benfiedler added the bug label May 26, 2022
@voileux
Copy link

voileux commented Jan 30, 2023

could you make a PR with your modification ?

Thank's in advance

@benfiedler
Copy link
Author

it's created - my apologies, this is my first PR

@benfiedler
Copy link
Author

In my previous PR the commit message did not meet standards. This one does -
#330

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants