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

Documented example for container creation does not work #803

Open
em-jones opened this issue Oct 17, 2023 · 4 comments
Open

Documented example for container creation does not work #803

em-jones opened this issue Oct 17, 2023 · 4 comments
Labels
area/docs Improvements or additions to documentation awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). kind/enhancement Improvements or new features

Comments

@em-jones
Copy link

em-jones commented Oct 17, 2023

What happened?

Using docs, I can't get any containers to run.

Example

# Find the latest Ubuntu precise image.
ubuntu_remote_image = docker.RemoteImage("ubuntuRemoteImage", name="ubuntu:precise")
# Start a container
ubuntu_container = docker.Container(
    "ubuntuContainer", image=ubuntu_remote_image.image_id
)

Output of pulumi about

CLI          
Version      3.88.1
Go Version   go1.21.1
Go Compiler  gc

Plugins
NAME        VERSION
aws-native  0.81.0
docker      4.4.3
mssql       0.0.7
python      unknown
random      4.14.0

Host     
OS       ubuntu
Version  22.04
Arch     x86_64

This project is written in python: executable='/home/ejones/repos/platform/.wt/data-platform/infra/venv/bin/python
3' version='3.11.6'

Current Stack: organization/infra/dev

TYPE                                        URN
pulumi:pulumi:Stack                         urn:pulumi:dev::infra::pulumi:pulumi:Stack::infra-dev
pulumi:providers:random                     urn:pulumi:dev::infra::pulumi:providers:random::default_4_14_0
random:index/randomPassword:RandomPassword  urn:pulumi:dev::infra::random:index/randomPassword:RandomPassword::pas
sword
pulumi:providers:docker                     urn:pulumi:dev::infra::pulumi:providers:docker::default_4_4_3
docker:index/remoteImage:RemoteImage        urn:pulumi:dev::infra::docker:index/remoteImage:RemoteImage::ubuntuRem
oteImage
docker:index/remoteImage:RemoteImage        urn:pulumi:dev::infra::docker:index/remoteImage:RemoteImage::mssql


Found no pending operations associated with dev

Backend        
Name           FCSWL458
URL            file://~
User           ejones
Organizations  
Token type     personal

Dependencies:
NAME               VERSION
pip                23.3.0
pulumi-aws-native  0.81.0
pulumi-docker      4.4.3
pulumi-random      4.14.0
pulumiverse-mssql  0.0.7
setuptools         68.2.2
wheel              0.41.2

Additional context

  • can run same images from docker cli
  • unable to see a failed container from pulumi up when running docker ps -a
  • using native docker engine in ubuntu based in wsl
  • trying to start a container with a name that's already in use throws an "already exists" error - leading me to believe there's no problem with default provider connecting to the daemon...

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).

@em-jones em-jones added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Oct 17, 2023
@AaronFriel
Copy link
Contributor

Do you see any error when you run the program? I reproduced your program in Pulumi YAML, and got this error:

docker:index:Container (container):
  error: 1 error occurred:
      * container exited immediately

If I add a command, however, like a sleep, the container runs and I can see it in CLI:

$ docker ps -a
CONTAINER ID   IMAGE          COMMAND            CREATED          STATUS          PORTS     NAMES
138ec79c001e   5b117edd0b76   "sleep infinity"   25 seconds ago   Up 24 seconds             container-5bf3655
Expand to see the YAML version of the program
name: tmp.d3GasjU4ZN
runtime: yaml
description: A minimal Pulumi YAML program
resources:
  remoteImage:
    type: docker:RemoteImage
    properties:
      name: ubuntu:precise
  container:
    type: docker:Container
    properties:
      image: ${remoteImage.imageId}
      # command: ["sleep", "infinity"]
outputs:
  remoteImageId:
    value: ${remoteImage.imageId}
  containerId:
    value: ${container.id}

@mikhailshilkov mikhailshilkov added awaiting-feedback Blocked on input from the author and removed needs-triage Needs attention from the triage team labels Oct 18, 2023
@em-jones
Copy link
Author

That works like a charm.
How would y'all feel about the suggestion the example should include this parameter?
My expectation would be: if I provide the same parameters that I use when running docker run, I would have the same result. Not saying that's the right thing to expect, but it feels intuitive enough that I don't expect to be the last person to think such a thing.

Thanks for the speedy support!

@mikhailshilkov
Copy link
Member

@em-jones I'm glad you resolved your issue! Thank you @AaronFriel for your help.

The example is actually based on an upstream example here, so it would need to change there first.

@mikhailshilkov mikhailshilkov added kind/enhancement Improvements or new features awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). area/docs Improvements or additions to documentation and removed kind/bug Some behavior is incorrect or out of spec awaiting-feedback Blocked on input from the author labels Oct 18, 2023
@em-jones
Copy link
Author

The example is actually based on an upstream example here, so it would need to change there first.

that checks out. I'll see if I can get this on their radar. Thanks again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docs Improvements or additions to documentation awaiting-upstream The issue cannot be resolved without action in another repository (may be owned by Pulumi). kind/enhancement Improvements or new features
Projects
None yet
Development

No branches or pull requests

3 participants