Trying to install into docker, but getting permission error.
-
Hi all, I tried to use the docker install command but am getting the fallowing message when I try to run it.
PermissionError: [Errno 13] Permission denied: './.env'
I tried running with sudo, and also do 'sudo -i'
docker is installed as I fallowed the tutorials here
(sorry if outside links aren't allowed, I couldn't find rules to this forum) https://docs.docker.com/engine/install/ubuntu/ -
Here is the full log if it helps.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1585 100 1585 0 0 68913 0 --:--:-- --:--:-- --:--:-- 68913
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 418 100 418 0 0 3834 0 --:--:-- --:--:-- --:--:-- 3834
Traceback (most recent call last):
File "/snap/docker/471/bin/docker-compose", line 11, in <module>
load_entry_point('docker-compose==1.25.5', 'console_scripts', 'docker-compose')()
File "/snap/docker/471/lib/python3.5/site-packages/compose/cli/main.py", line 72, in main
command()
File "/snap/docker/471/lib/python3.5/site-packages/compose/cli/main.py", line 125, in perform_command
project = project_from_options('.', options)
File "/snap/docker/471/lib/python3.5/site-packages/compose/cli/command.py", line 47, in project_from_options
environment = Environment.from_env_file(override_dir or project_dir, environment_file)
File "/snap/docker/471/lib/python3.5/site-packages/compose/config/environment.py", line 77, in from_env_file
instance = _initialize()
File "/snap/docker/471/lib/python3.5/site-packages/compose/config/environment.py", line 72, in _initialize
return cls(env_vars_from_file(env_file_path))
File "/snap/docker/471/lib/python3.5/site-packages/compose/config/environment.py", line 43, in env_vars_from_file
with contextlib.closing(codecs.open(filename, 'r', 'utf-8-sig')) as fileobj:
File "/snap/docker/471/usr/lib/python3.5/codecs.py", line 895, in open
file = builtins.open(filename, mode, buffering)
PermissionError: [Errno 13] Permission denied: './.env' -
If you have installed docker engine following the mentioned guide, then it's probably ok. You haven't mentioned what kind of docker-compose toolings you use. Whatever it is, you have clearly installed it through snap. It is not trivial for snap package developers to properly handle snap isolation, so various permission related issues are pretty common. Tweak your snap package permissions or install docker-compose in a classic way.
-
@mgetka Thanks for the hints. I am fairly new to docker, but know a good amount of linux so worked through it. Do you know a good tutorial for installing it the way you described? Or how to add snap permissions?
Also not sure what the docker-compose tool is, would that be related to me installing with the docker repo method?
-
Long story short, docker-compose is a tool that facilitates running services composed of multiple containers. Personally, I have mixed feelings about snap, and use it only for a limited number of desktop GUI based applications, so I cannot help you with permissions issues. it would be most straight forward just to install docker-compose using the docker provided guide.
-
For anyone interested I got this running by one installing docker-compose from the actual docker tutorial on how to do it, and then giving docker permission to run commands as root. There is a tutorial on how to do it on. On top of those I moved it to a server with 2gb of ram, as I noticed a few out of memory errors when it was trying to start up.
https://docs.docker.com/engine/install/linux-postinstall/