question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consider removing dbt_user from dbt's Docker image

See original GitHub issue

Describe the feature

The Dockerfile definition for dbt creates dbt_user as the user to run subsequent commands under. This can cause issues when mounting volumes where the host filesystem is owned by root. The specific situation I’m thinking of is using the dbt Docker image as a build step in a CI environment, it’s common for the files/directories in these environments to be owned by root, but the expectation is that build steps are still able to create directories and write files. Using the dbt Docker image in this context results in permission issues.

I’d like to suggest removing dbt_user from the image definition and using the default root user instead. Most Dockerized CLI tools I’ve come across do not specify an explicit user and use root as the default (refer: gcloud, doctl, busybox). Users using the image locally would be able to override the user at runtime using the --user flag if there was a desire or need to do so.

Describe alternatives you’ve considered

Our particular issue was using the dbt Docker image in Cloud Build. We were getting errors that dbt was unable to create the target/ and logs/ directories due to permission issues. We ended up having to run chmod -R 777 ./ on the working directory prior to running dbt to make things work. This was fine for us as the filesystem is ephemeral, but in other situations you obviously wouldn’t want to do this (you’d also have access to the --user flag, which isn’t an available option in Cloud Build).

Additional context

N/A

Who will this benefit?

This change would benefit users who use the dbt Docker image as part of their CI/CD pipeline. Having the image run under dbt_user imposes constraints that require workarounds that could ideally be avoided.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
meurant-naudecommented, Jul 6, 2020

Hi there @beckjake, Chris and I worked together so I thought I’d give you an update. I’ve upgraded to 0.17.1rc3 and my testing would indicate that the issue has been resolved. @christippett might wanted to do testing on his end too to confirm my findings. Cheers, Meurant

1reaction
christippettcommented, Jul 28, 2020

@beckjake apologies for taking so long to get back to you. I can confirm I’m currently using the the dbt Docker image (tag 0.17.1rc4) in Cloud Build with no issues.

Read more comments on GitHub >

github_iconTop Results From Across the Web

docker image rm
docker image rm: Remove one or more images.
Read more >
docker image prune - Docker Documentation
docker image prune -a WARNING! This will remove all images without at least one container associated to them. Are you sure you want...
Read more >
Prune unused Docker objects - Docker Documentation
This will remove all images without at least one container associated to them. ... For example, to only consider images created more than...
Read more >
docker rm - Docker Documentation
Use the docker container prune command to remove all stopped containers, or refer to ... To use this approach on Windows, consider using...
Read more >
docker trust signer remove
Description . docker trust signer remove removes signers from signed repositories. For example uses of this command, refer to the examples section...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found