CA Lee
06/06/2021, 11:03 AM0.14.21
I am using VS Code, dev container, and running pip install prefect[aws]
in the build step . After the container is done, I am unable to do `prefect auth login -t {token}`as it leads to the error below:
vscode ➜ /workspaces/dbt-bigquery (main ✗) $ prefect auth login -t $PREFECT_AUTH_TOKEN
Traceback (most recent call last):
File "/usr/local/lib/python3.8/pathlib.py", line 1287, in mkdir
self._accessor.mkdir(self, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/home/vscode/.prefect/client/https-api.prefect.io-graphql'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/prefect", line 8, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/prefect/cli/auth.py", line 83, in login
success_login = client.login_to_tenant(
File "/usr/local/lib/python3.8/site-packages/prefect/client/client.py", line 654, in login_to_tenant
self._save_local_settings(settings)
File "/usr/local/lib/python3.8/site-packages/prefect/client/client.py", line 524, in _save_local_settings
self._local_settings_path.parent.mkdir(exist_ok=True, parents=True)
File "/usr/local/lib/python3.8/pathlib.py", line 1291, in mkdir
self.parent.mkdir(parents=True, exist_ok=True)
File "/usr/local/lib/python3.8/pathlib.py", line 1287, in mkdir
self._accessor.mkdir(self, mode)
PermissionError: [Errno 13] Permission denied: '/home/vscode/.prefect/client'
CA Lee
06/06/2021, 11:11 AM# prefect backend cloud - secrets
RUN mkdir -p /home/vscode/.prefect
COPY .devcontainer/config.toml /home/vscode/.prefect
Running ls -al
on this folder after it was built shows that the folder belongs to root:
vscode ➜ ~/.prefect $ ls -al
total 12
drwxr-xr-x 1 root root 4096 Jun 6 10:59 .
drwxr-xr-x 1 vscode vscode 4096 Jun 6 11:08 ..
-rw-r--r-- 1 root root 31 Jun 6 07:32 config.toml
I tried to change the user to vscode before creating the folder, but then the container fails to build
...
USER vscode
# prefect backend cloud - secrets
RUN mkdir -p /home/vscode/.prefect
COPY .devcontainer/config.toml /home/vscode/.prefect
Stumped here .. does anyone have any insight into this?CA Lee
06/06/2021, 11:19 AMRUN chown -R vscode:vscode /home/vscode/.prefect
It seems clunky to me though. Anyone has any other ideas on whats the best way to create folders as non-root user in the Docker build step ?
Switching to a different user before creating the folders doesn't seem to work ..
Switching back to root and the container is built successfully, but the files end up belonging to rootBring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.
Powered by