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

chore: update dind examples to use onCreateCommand #350

Merged
merged 7 commits into from
Sep 19, 2024

Conversation

johnstcn
Copy link
Member

@johnstcn johnstcn commented Sep 19, 2024

The existing Docker examples override ENVBUILDER_INIT_SCRIPT, which is annoying if you're trying to use them with Coder. Update the examples in docker to use onCreateCommand instead.

To test them out locally:

make build
docker run -it --rm --privileged -v $PWD/examples/docker/02_dind:/workspaces/empty -e ENVBUILDER_INIT_SCRIPT=bash envbuilder:latest

@johnstcn johnstcn self-assigned this Sep 19, 2024
@matifali matifali marked this pull request as ready for review September 19, 2024 14:59
@matifali matifali marked this pull request as draft September 19, 2024 14:59
@johnstcn johnstcn changed the title chore: update dind examples chore: update dind examples to use onCreateCommand Sep 19, 2024
@johnstcn johnstcn marked this pull request as ready for review September 19, 2024 15:37
Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor nits but otherwise LGTM.

examples/docker/02_dind/on-create.sh Outdated Show resolved Hide resolved
docs/docker.md Outdated Show resolved Hide resolved
examples/docker/02_dind/on-create.sh Outdated Show resolved Hide resolved
examples/docker/02_dind/on-create.sh Outdated Show resolved Hide resolved
# which will handle most of the steps of setting up Docker.
# We can't put this in the entrypoint as it gets overridden, so
# we call it in the on-create script.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we not support setting entrypoint in the Dockerfile at all? Maybe we should in the future.

Copy link
Member Author

@johnstcn johnstcn Sep 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My observation is that whatever entrypoint you set gets overridden by ENVBUILDER_INIT_COMMAND / ENVBUILDER_INIT_SCRIPT. But agreed, we should fall back to the entrypoint in the Dockerfile.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a Coder workspace we need to have coder_agent.*.init_script as the entry point so another option to handle the ENTRYPOINT is to run it as part of coder_agent startup_script. This will work for at least the case when envbuilder is used with Coder.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filed #351 to follow up on this.

@johnstcn johnstcn merged commit 7c8e6a4 into main Sep 19, 2024
4 checks passed
@johnstcn johnstcn deleted the cj/update-dind-examples branch September 19, 2024 17:42
mafredri pushed a commit that referenced this pull request Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants