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

"failed to connect to any docker daemon" when using docker.getRegistryImage with docker.Provider and DOCKER_HOST changes #1106

Open
korosccj opened this issue May 23, 2024 · 7 comments
Labels
impact/usability Something that impacts users' ability to use the product easily and intuitively kind/bug Some behavior is incorrect or out of spec size/S Estimated effort to complete (1-2 days).

Comments

@korosccj
Copy link
Contributor

What happened?

What were you trying to accomplish?
Modify a pulumi stack from a system that had a different DOCKER_HOST configuration than the system that created the initial stack.

What did you expect to happen?
The stack to be updated successfully.

Which resources are involved?

  • docker.Provider
  • docker.RemoteImage

Example

https://github.com/korosccj/pulumi-docker-test

$ npm run up     

> [email protected] up
> ts-node ./index.ts

successfully initialized stack
refreshing stack...
Refreshing (pulumi-docker-test):

Resources:

Duration: 1s

refresh complete
updating stack...
Updating (pulumi-docker-test):

 +  pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test creating (0s) 

 +  pulumi:providers:docker docker-provider creating (0s) 

 +  pulumi:providers:docker docker-provider created (0.00s) 

 +  docker:index:RemoteImage docker-container-pull creating (0s) 

 +  docker:index:RemoteImage docker-container-pull created (0.11s) 

 +  pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test created (0.47s) 
Resources:
    + 3 created

Duration: 1s

update summary: 
{
    "create": 3
}
➜  pulumi-docker-test git:(main) $ unset DOCKER_HOST
➜  pulumi-docker-test git:(main) $ npm run up       

> [email protected] up
> ts-node ./index.ts

successfully initialized stack
refreshing stack...
Refreshing (pulumi-docker-test):

 ~  pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test refreshing (0s) 
    pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test running 

 ~  pulumi:providers:docker docker-provider refreshing (0s) 
 ~  docker:index:RemoteImage docker-container-pull refreshing (0s) 
    pulumi:providers:docker docker-provider  

 ~  docker:index:RemoteImage docker-container-pull refreshing (0s) error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon
 ~  docker:index:RemoteImage docker-container-pull **refreshing failed** error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon
    pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test running error: update failed

    pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test **failed** 1 error
Diagnostics:

  docker:index:RemoteImage (docker-container-pull):
    error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon

  pulumi:pulumi:Stack (pulumi-docker-test-pulumi-docker-test):
    error: update failed

Resources:
    2 unchanged

Duration: 1s


CommandError: code: -2
 stdout: 
 stderr: Command failed with exit code 255: pulumi refresh --yes --skip-preview --exec-kind auto.inline --stack pulumi-docker-test --non-interactive
Refreshing (pulumi-docker-test):

 ~  pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test refreshing (0s) 
    pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test running 
 ~  pulumi:providers:docker docker-provider refreshing (0s) 
 ~  docker:index:RemoteImage docker-container-pull refreshing (0s) 
    pulumi:providers:docker docker-provider  
 ~  docker:index:RemoteImage docker-container-pull refreshing (0s) error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon
 ~  docker:index:RemoteImage docker-container-pull **refreshing failed** error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon
    pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test running error: update failed
    pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test **failed** 1 error
Diagnostics:
  docker:index:RemoteImage (docker-container-pull):
    error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon

  pulumi:pulumi:Stack (pulumi-docker-test-pulumi-docker-test):
    error: update failed

Resources:
    2 unchanged

Duration: 1s

 err?: Error: Command failed with exit code 255: pulumi refresh --yes --skip-preview --exec-kind auto.inline --stack pulumi-docker-test --non-interactive
Refreshing (pulumi-docker-test):

 ~  pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test refreshing (0s) 
    pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test running 
 ~  pulumi:providers:docker docker-provider refreshing (0s) 
 ~  docker:index:RemoteImage docker-container-pull refreshing (0s) 
    pulumi:providers:docker docker-provider  
 ~  docker:index:RemoteImage docker-container-pull refreshing (0s) error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon
 ~  docker:index:RemoteImage docker-container-pull **refreshing failed** error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon
    pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test running error: update failed
    pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test **failed** 1 error
Diagnostics:
  docker:index:RemoteImage (docker-container-pull):
    error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon

  pulumi:pulumi:Stack (pulumi-docker-test-pulumi-docker-test):
    error: update failed

Resources:
    2 unchanged

Duration: 1s


    at Object.createCommandError (/Users/X/Documents/UKI/Projects/pulumi-docker-test/node_modules/@pulumi/automation/errors.ts:78:11)
    at /Users/X/Documents/UKI/Projects/pulumi-docker-test/node_modules/@pulumi/automation/cmd.ts:212:15
    at Generator.throw (<anonymous>)
    at rejected (/Users/X/Documents/UKI/Projects/pulumi-docker-test/node_modules/@pulumi/pulumi/automation/cmd.js:19:65)
    at processTicksAndRejections (node:internal/process/task_queues:95:5) {
  commandResult: CommandResult {
    stdout: '',
    stderr: 'Command failed with exit code 255: pulumi refresh --yes --skip-preview --exec-kind auto.inline --stack pulumi-docker-test --non-interactive\n' +
      'Refreshing (pulumi-docker-test):\n' +
      '\n' +
      ' ~  pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test refreshing (0s) \n' +
      '    pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test running \n' +
      ' ~  pulumi:providers:docker docker-provider refreshing (0s) \n' +
      ' ~  docker:index:RemoteImage docker-container-pull refreshing (0s) \n' +
      '    pulumi:providers:docker docker-provider  \n' +
      ' ~  docker:index:RemoteImage docker-container-pull refreshing (0s) error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon\n' +
      ' ~  docker:index:RemoteImage docker-container-pull **refreshing failed** error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon\n' +
      '    pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test running error: update failed\n' +
      '    pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test **failed** 1 error\n' +
      'Diagnostics:\n' +
      '  docker:index:RemoteImage (docker-container-pull):\n' +
      '    error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon\n' +
      '\n' +
      '  pulumi:pulumi:Stack (pulumi-docker-test-pulumi-docker-test):\n' +
      '    error: update failed\n' +
      '\n' +
      'Resources:\n' +
      '    2 unchanged\n' +
      '\n' +
      'Duration: 1s\n',
    code: -2,
    err: Error: Command failed with exit code 255: pulumi refresh --yes --skip-preview --exec-kind auto.inline --stack pulumi-docker-test --non-interactive
    Refreshing (pulumi-docker-test):
    
     ~  pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test refreshing (0s) 
        pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test running 
     ~  pulumi:providers:docker docker-provider refreshing (0s) 
     ~  docker:index:RemoteImage docker-container-pull refreshing (0s) 
        pulumi:providers:docker docker-provider  
     ~  docker:index:RemoteImage docker-container-pull refreshing (0s) error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon
     ~  docker:index:RemoteImage docker-container-pull **refreshing failed** error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon
        pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test running error: update failed
        pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test **failed** 1 error
    Diagnostics:
      docker:index:RemoteImage (docker-container-pull):
        error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon
    
      pulumi:pulumi:Stack (pulumi-docker-test-pulumi-docker-test):
        error: update failed
    
    Resources:
        2 unchanged
    
    Duration: 1s
    
        at makeError (/Users/X/Documents/UKI/Projects/pulumi-docker-test/node_modules/execa/lib/error.js:60:11)
        at handlePromise (/Users/X/Documents/UKI/Projects/pulumi-docker-test/node_modules/execa/index.js:118:26)
        at processTicksAndRejections (node:internal/process/task_queues:95:5) {
      shortMessage: 'Command failed with exit code 255: pulumi refresh --yes --skip-preview --exec-kind auto.inline --stack pulumi-docker-test --non-interactive',
      command: 'pulumi refresh --yes --skip-preview --exec-kind auto.inline --stack pulumi-docker-test --non-interactive',
      escapedCommand: 'pulumi refresh --yes --skip-preview --exec-kind auto.inline --stack pulumi-docker-test --non-interactive',
      exitCode: 255,
      signal: undefined,
      signalDescription: undefined,
      stdout: 'Refreshing (pulumi-docker-test):\n' +
        '\n' +
        ' ~  pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test refreshing (0s) \n' +
        '    pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test running \n' +
        ' ~  pulumi:providers:docker docker-provider refreshing (0s) \n' +
        ' ~  docker:index:RemoteImage docker-container-pull refreshing (0s) \n' +
        '    pulumi:providers:docker docker-provider  \n' +
        ' ~  docker:index:RemoteImage docker-container-pull refreshing (0s) error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon\n' +
        ' ~  docker:index:RemoteImage docker-container-pull **refreshing failed** error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon\n' +
        '    pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test running error: update failed\n' +
        '    pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test **failed** 1 error\n' +
        'Diagnostics:\n' +
        '  docker:index:RemoteImage (docker-container-pull):\n' +
        '    error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon\n' +
        '\n' +
        '  pulumi:pulumi:Stack (pulumi-docker-test-pulumi-docker-test):\n' +
        '    error: update failed\n' +
        '\n' +
        'Resources:\n' +
        '    2 unchanged\n' +
        '\n' +
        'Duration: 1s\n',
      stderr: '',
      failed: true,
      timedOut: false,
      isCanceled: false,
      killed: false
    }
  }
}
➜  pulumi-docker-test git:(main) $ export DOCKER_HOST=unix:///$HOME/.docker/run/docker.sock
➜  pulumi-docker-test git:(main) $ npm run up                                              

> [email protected] up
> ts-node ./index.ts

successfully initialized stack
refreshing stack...
Refreshing (pulumi-docker-test):

 ~  pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test refreshing (0s) 
    pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test running 

 ~  pulumi:providers:docker docker-provider refreshing (0s) 
 ~  docker:index:RemoteImage docker-container-pull refreshing (0s) 
    pulumi:providers:docker docker-provider  

 ~  docker:index:RemoteImage docker-container-pull refreshing (0s) error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon

 ~  docker:index:RemoteImage docker-container-pull **refreshing failed** error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon
    pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test running error: update failed

    pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test **failed** 1 error
Diagnostics:

  docker:index:RemoteImage (docker-container-pull):
    error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon

  pulumi:pulumi:Stack (pulumi-docker-test-pulumi-docker-test):
    error: update failed

Resources:
    2 unchanged

Duration: 1s


CommandError: code: -2
 stdout: 
 stderr: Command failed with exit code 255: pulumi refresh --yes --skip-preview --exec-kind auto.inline --stack pulumi-docker-test --non-interactive
Refreshing (pulumi-docker-test):

 ~  pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test refreshing (0s) 
    pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test running 
 ~  pulumi:providers:docker docker-provider refreshing (0s) 
 ~  docker:index:RemoteImage docker-container-pull refreshing (0s) 
    pulumi:providers:docker docker-provider  
 ~  docker:index:RemoteImage docker-container-pull refreshing (0s) error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon
 ~  docker:index:RemoteImage docker-container-pull **refreshing failed** error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon
    pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test running error: update failed
    pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test **failed** 1 error
Diagnostics:
  docker:index:RemoteImage (docker-container-pull):
    error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon

  pulumi:pulumi:Stack (pulumi-docker-test-pulumi-docker-test):
    error: update failed

Resources:
    2 unchanged

Duration: 1s

 err?: Error: Command failed with exit code 255: pulumi refresh --yes --skip-preview --exec-kind auto.inline --stack pulumi-docker-test --non-interactive
Refreshing (pulumi-docker-test):

 ~  pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test refreshing (0s) 
    pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test running 
 ~  pulumi:providers:docker docker-provider refreshing (0s) 
 ~  docker:index:RemoteImage docker-container-pull refreshing (0s) 
    pulumi:providers:docker docker-provider  
 ~  docker:index:RemoteImage docker-container-pull refreshing (0s) error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon
 ~  docker:index:RemoteImage docker-container-pull **refreshing failed** error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon
    pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test running error: update failed
    pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test **failed** 1 error
Diagnostics:
  docker:index:RemoteImage (docker-container-pull):
    error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon

  pulumi:pulumi:Stack (pulumi-docker-test-pulumi-docker-test):
    error: update failed

Resources:
    2 unchanged

Duration: 1s


    at Object.createCommandError (/Users/X/Documents/UKI/Projects/pulumi-docker-test/node_modules/@pulumi/automation/errors.ts:78:11)
    at /Users/X/Documents/UKI/Projects/pulumi-docker-test/node_modules/@pulumi/automation/cmd.ts:212:15
    at Generator.throw (<anonymous>)
    at rejected (/Users/X/Documents/UKI/Projects/pulumi-docker-test/node_modules/@pulumi/pulumi/automation/cmd.js:19:65)
    at processTicksAndRejections (node:internal/process/task_queues:95:5) {
  commandResult: CommandResult {
    stdout: '',
    stderr: 'Command failed with exit code 255: pulumi refresh --yes --skip-preview --exec-kind auto.inline --stack pulumi-docker-test --non-interactive\n' +
      'Refreshing (pulumi-docker-test):\n' +
      '\n' +
      ' ~  pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test refreshing (0s) \n' +
      '    pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test running \n' +
      ' ~  pulumi:providers:docker docker-provider refreshing (0s) \n' +
      ' ~  docker:index:RemoteImage docker-container-pull refreshing (0s) \n' +
      '    pulumi:providers:docker docker-provider  \n' +
      ' ~  docker:index:RemoteImage docker-container-pull refreshing (0s) error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon\n' +
      ' ~  docker:index:RemoteImage docker-container-pull **refreshing failed** error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon\n' +
      '    pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test running error: update failed\n' +
      '    pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test **failed** 1 error\n' +
      'Diagnostics:\n' +
      '  docker:index:RemoteImage (docker-container-pull):\n' +
      '    error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon\n' +
      '\n' +
      '  pulumi:pulumi:Stack (pulumi-docker-test-pulumi-docker-test):\n' +
      '    error: update failed\n' +
      '\n' +
      'Resources:\n' +
      '    2 unchanged\n' +
      '\n' +
      'Duration: 1s\n',
    code: -2,
    err: Error: Command failed with exit code 255: pulumi refresh --yes --skip-preview --exec-kind auto.inline --stack pulumi-docker-test --non-interactive
    Refreshing (pulumi-docker-test):
    
     ~  pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test refreshing (0s) 
        pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test running 
     ~  pulumi:providers:docker docker-provider refreshing (0s) 
     ~  docker:index:RemoteImage docker-container-pull refreshing (0s) 
        pulumi:providers:docker docker-provider  
     ~  docker:index:RemoteImage docker-container-pull refreshing (0s) error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon
     ~  docker:index:RemoteImage docker-container-pull **refreshing failed** error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon
        pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test running error: update failed
        pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test **failed** 1 error
    Diagnostics:
      docker:index:RemoteImage (docker-container-pull):
        error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon
    
      pulumi:pulumi:Stack (pulumi-docker-test-pulumi-docker-test):
        error: update failed
    
    Resources:
        2 unchanged
    
    Duration: 1s
    
        at makeError (/Users/X/Documents/UKI/Projects/pulumi-docker-test/node_modules/execa/lib/error.js:60:11)
        at handlePromise (/Users/X/Documents/UKI/Projects/pulumi-docker-test/node_modules/execa/index.js:118:26)
        at processTicksAndRejections (node:internal/process/task_queues:95:5) {
      shortMessage: 'Command failed with exit code 255: pulumi refresh --yes --skip-preview --exec-kind auto.inline --stack pulumi-docker-test --non-interactive',
      command: 'pulumi refresh --yes --skip-preview --exec-kind auto.inline --stack pulumi-docker-test --non-interactive',
      escapedCommand: 'pulumi refresh --yes --skip-preview --exec-kind auto.inline --stack pulumi-docker-test --non-interactive',
      exitCode: 255,
      signal: undefined,
      signalDescription: undefined,
      stdout: 'Refreshing (pulumi-docker-test):\n' +
        '\n' +
        ' ~  pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test refreshing (0s) \n' +
        '    pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test running \n' +
        ' ~  pulumi:providers:docker docker-provider refreshing (0s) \n' +
        ' ~  docker:index:RemoteImage docker-container-pull refreshing (0s) \n' +
        '    pulumi:providers:docker docker-provider  \n' +
        ' ~  docker:index:RemoteImage docker-container-pull refreshing (0s) error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon\n' +
        ' ~  docker:index:RemoteImage docker-container-pull **refreshing failed** error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon\n' +
        '    pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test running error: update failed\n' +
        '    pulumi:pulumi:Stack pulumi-docker-test-pulumi-docker-test **failed** 1 error\n' +
        'Diagnostics:\n' +
        '  docker:index:RemoteImage (docker-container-pull):\n' +
        '    error: Docker native provider returned an unexpected error from Configure: failed to connect to any docker daemon\n' +
        '\n' +
        '  pulumi:pulumi:Stack (pulumi-docker-test-pulumi-docker-test):\n' +
        '    error: update failed\n' +
        '\n' +
        'Resources:\n' +
        '    2 unchanged\n' +
        '\n' +
        'Duration: 1s\n',
      stderr: '',
      failed: true,
      timedOut: false,
      isCanceled: false,
      killed: false
    }
  }
}

Output of pulumi about

CLI
Version 3.112.0
Go Version go1.22.1
Go Compiler gc

Plugins
NAME VERSION
docker 4.5.3
nodejs unknown

Host
OS darwin
Version 13.5.2
Arch arm64

This project is written in nodejs: executable='/opt/homebrew/bin/node' version='v22.1.0'

Current Stack: organization/pulumi-docker-test/pulumi-docker-test

TYPE URN
pulumi:pulumi:Stack urn:pulumi:pulumi-docker-test::pulumi-docker-test::pulumi:pulumi:Stack::pulumi-docker-test-pulumi-docker-test
pulumi:providers:docker urn:pulumi:pulumi-docker-test::pulumi-docker-test::pulumi:providers:docker::docker-provider
docker:index/remoteImage:RemoteImage urn:pulumi:pulumi-docker-test::pulumi-docker-test::docker:index/remoteImage:RemoteImage::docker-container-pull

Found no pending operations associated with pulumi-docker-test

Backend
Name X-MacBook-Pro-1028.local
URL file://./
User X
Organizations
Token type personal

Dependencies:
NAME VERSION
@pulumi/docker 4.5.3
@pulumi/pulumi 3.116.1
@types/node 20.12.12
ts-node 10.9.2
typescript 5.4.5

Pulumi locates its logs in /var/folders/2s/w8c3231d7gv1yw2qdrd5nbsm0000gn/T/ by default

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@korosccj korosccj added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels May 23, 2024
@blampe blampe added impact/usability Something that impacts users' ability to use the product easily and intuitively size/S Estimated effort to complete (1-2 days). and removed needs-triage Needs attention from the triage team labels May 28, 2024
@blampe
Copy link
Contributor

blampe commented May 31, 2024

Thank you @korosccj for the excellent repro! I can confirm I see the value of DOCKER_HOST persisted in state and then provided to the subsequent Configure call despite the environment variable being unset. This might be an issue with TF bridging, I need to look into it more.

@blampe
Copy link
Contributor

blampe commented May 31, 2024

Ah, I overlooked the refresh in your example and I think that's the root of it. Refresh simply uses whatever you previously persisted in your state, so when you refresh after unsetting the environment variable it will still use the previous host value. This is why things work when the environment variable is unset and socat is still running.

You could argue that the precedence of DOCKER_HOST vs. the provider's configured host should be switched so the env var always takes precedence, but that's a pretty big change.

@korosccj
Copy link
Contributor Author

That does make sense in the case where DOCKER_HOST is unset, but what about the case when DOCKER_HOST is set to a new value such as the unix socket unix:///$HOME/.docker/run/docker.sock?

@blampe
Copy link
Contributor

blampe commented May 31, 2024

That does make sense in the case where DOCKER_HOST is unset, but what about the case when DOCKER_HOST is set to a new value such as the unix socket unix:///$HOME/.docker/run/docker.sock?

The refresh will fail because it will alway use whatever the last successful update used (the original socat value). However if you change the value of DOCKER_HOST and skip the refresh, just go straight to the update, it should work fine.

This is admittedly awkward because we're mixing shared state with configuration that's scoped to a workstation.

@korosccj
Copy link
Contributor Author

OK. I will test that.

I do worry about the implications of not forcing the refresh before attempting to apply changes since it is a shared state with many other resources. Any thoughts on how best to safely proceed using that method since switching the env var precedence sounds like a change that would not happen?

@mikhailshilkov
Copy link
Member

@blampe So do you have an idea in mind of what can be improved here? Should we not store DOCKER_HOST in the state?

@korosccj
Copy link
Contributor Author

korosccj commented Jun 10, 2024

OK. I will test that.

Following up. We attempted to operate without requiring a refresh prior to applying changes to the stack and that caused other issues. Specifically in our case we have a flow like this,

  1. Pull image from private ECR to local docker
  2. run local command to export docker archive
  3. upload to api using custom pulumi resource

The archive created in step 2 would not exist on a workstation other than the original creator. The refresh allows our program to be portable since it realizes the local archive is missing and recreates it. Without the refresh, it attempts to delete it on update and throws an exception since the archive does not exist as it expects.

We have since reverted back to requiring the refresh prior to any updates and continue to deal with the DOCKER_HOST issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact/usability Something that impacts users' ability to use the product easily and intuitively kind/bug Some behavior is incorrect or out of spec size/S Estimated effort to complete (1-2 days).
Projects
None yet
Development

No branches or pull requests

3 participants