Docker: IOError: [Errno 13] Permission denied: u'./.env

Steps to reproduce

Installation according to: https://doc.owncloud.org/server/10.4/admin_manual/installation/docker/

  1. docker pull owncloud/server
  2. wget https://raw.githubusercontent.com/owncloud/docs/master/modules/admin_manual/examples/installation/docker/docker-compose.yml
  3. vi .env
    OWNCLOUD_VERSION=18.09.9
    OWNCLOUD_DOMAIN=localhost
    ADMIN_USERNAME=***
    ADMIN_PASSWORD=***
    HTTP_PORT=8080
    HTTPS_PORT=443
  4. docker compose up -d

Expected behaviour

Tell us what should happen
A docker container shoud be created

Actual behaviour

Tell us what happens instead
When I do: docker-compose up -d
I get the following Errorroot@testsrv:~# cd /home/owncloud-docker-server/
root@testsrv:/home/owncloud-docker-server# ll
total 8
drwxr-xr-x 2 root root 44 Feb 16 15:19 ./
drwxr-xr-x 4 root root 48 Feb 16 15:04 …/
-rw-r–r-- 1 root root 1650 Feb 16 15:06 docker-compose.yml
-rwx------ 1 root root 124 Feb 16 15:19 .env*
root@testsrv:/home/owncloud-docker-server# chmod 777 .env
root@testsrv:/home/owncloud-docker-server# docker-compose up -d
Traceback (most recent call last):
File “/snap/docker/423/bin/docker-compose”, line 11, in
load_entry_point(‘docker-compose==1.23.2’, ‘console_scripts’, ‘docker-compose’)()
File “/snap/docker/423/lib/python2.7/site-packages/compose/cli/main.py”, line 71, in main
command()
File “/snap/docker/423/lib/python2.7/site-packages/compose/cli/main.py”, line 124, in perform_command
project = project_from_options(’.’, options)
File “/snap/docker/423/lib/python2.7/site-packages/compose/cli/command.py”, line 27, in project_from_options
environment = Environment.from_env_file(override_dir or project_dir)
File “/snap/docker/423/lib/python2.7/site-packages/compose/config/environment.py”, line 61, in from_env_file
instance = _initialize()
File “/snap/docker/423/lib/python2.7/site-packages/compose/config/environment.py”, line 57, in _initialize
return cls(env_vars_from_file(env_file_path))
File “/snap/docker/423/lib/python2.7/site-packages/compose/config/environment.py”, line 35, in env_vars_from_file
with contextlib.closing(codecs.open(filename, ‘r’, ‘utf-8-sig’)) as fileobj:
File “/snap/docker/423/usr/lib/python2.7/codecs.py”, line 896, in open
file = builtin.open(filename, mode, buffering)
IOError: [Errno 13] Permission denied: u’./.env’

Server configuration

Operating system:
Ubuntu Server 19.10 (64bit)

Web server:
docker
Database:
docker
PHP version:
docker
ownCloud version: (see ownCloud admin page)
root@testsrv:~# cd /home/owncloud-docker-server/
root@testsrv:/home/owncloud-docker-server# ll
total 8
drwxr-xr-x 2 root root 44 Feb 16 15:19 ./
drwxr-xr-x 4 root root 48 Feb 16 15:04 …/
-rw-r–r-- 1 root root 1650 Feb 16 15:06 docker-compose.yml
-rwx------ 1 root root 124 Feb 16 15:19 .env*
root@testsrv:/home/owncloud-docker-server# chmod 777 .env
root@testsrv:/home/owncloud-docker-server# docker-compose up -d
Traceback (most recent call last):
File “/snap/docker/423/bin/docker-compose”, line 11, in
load_entry_point(‘docker-compose==1.23.2’, ‘console_scripts’, ‘docker-compose’)()
File “/snap/docker/423/lib/python2.7/site-packages/compose/cli/main.py”, line 71, in main
command()
File “/snap/docker/423/lib/python2.7/site-packages/compose/cli/main.py”, line 124, in perform_command
project = project_from_options(’.’, options)
File “/snap/docker/423/lib/python2.7/site-packages/compose/cli/command.py”, line 27, in project_from_options
environment = Environment.from_env_file(override_dir or project_dir)
File “/snap/docker/423/lib/python2.7/site-packages/compose/config/environment.py”, line 61, in from_env_file
instance = _initialize()
File “/snap/docker/423/lib/python2.7/site-packages/compose/config/environment.py”, line 57, in _initialize
return cls(env_vars_from_file(env_file_path))
File “/snap/docker/423/lib/python2.7/site-packages/compose/config/environment.py”, line 35, in env_vars_from_file
with contextlib.closing(codecs.open(filename, ‘r’, ‘utf-8-sig’)) as fileobj:
File “/snap/docker/423/usr/lib/python2.7/codecs.py”, line 896, in open
file = builtin.open(filename, mode, buffering)
IOError: [Errno 13] Permission denied: u’./.env’

Updated from an older ownCloud or fresh install:
fresh install
Where did you install ownCloud from:
docker pull owncloud/server
Signing status (ownCloud 9.0 and above):
docker

Login as admin user into your ownCloud and access 
http://example.com/index.php/settings/integrity/failed 
paste the results into https://gist.github.com/ and puth the link here.

The content of config/config.php:

Log in to the web-UI with an administrator account and click on
'admin' -> 'Generate Config Report' -> 'Download ownCloud config report'
This report includes the config.php settings, the list of activated apps
and other details in a well sanitized form.

or 

If you have access to your command line run e.g.:
sudo -u www-data php occ config:list system
from within your ownCloud installation folder

*ATTENTION:* Do not post your config.php file in public as is. Please use one of the above
methods whenever possible. Both, the generated reports from the web-ui and from occ config:list
consistently remove sensitive data. You still may want to review the report before sending.
If done manually then it is critical for your own privacy to dilligently
remove *all* host names, passwords, usernames, salts and other credentials before posting.
You should assume that attackers find such information and will use them against your systems.

List of activated apps:

If you have access to your command line run e.g.:
sudo -u www-data php occ app:list
from within your ownCloud installation folder.

Are you using external storage, if yes which one: local/smb/sftp/…

Are you using encryption: yes/no

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/…

LDAP configuration (delete this part if not used)

With access to your command line run e.g.:
sudo -u www-data php occ ldap:show-config
from within your ownCloud installation folder

Without access to your command line download the data/owncloud.db to your local
computer or access your SQL server remotely and run the select query:
SELECT * FROM `oc_appconfig` WHERE `appid` = 'user_ldap';


Eventually replace sensitive data as the name/IP-address of your LDAP server or groups.

Client configuration

Browser:

Operating system:

Logs

Web server error log

Insert your webserver log here

ownCloud log (data/owncloud.log)

Insert your ownCloud log here

Browser log

Insert your browser log here, this could for example include:

a) The javascript console log
b) The network log 
c) ...

I did exaclty the same on my laptop with Ubuntu 19.10 Desktop, there this error did not occur…
Any ideas anyone?

Haven’t tried found this

I’m pretty sure this is due to your docker setup being installed through snap and you might need to provide environment variables in a different way.
They also have a support forum, perhaps you can find something there:

try this one, i will try myself tonight

https://hub.docker.com/r/owncloud/server

What next `

i tried localhost:8080 and got nothing

bash: http://localhost: No such file or directory
pi@lucas:~ $ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
99f710680fdd owncloud/server “/usr/bin/entrypoint…” 6 minutes ago Up 6 minutes 8080/tcp musing_mclaren

You’ll need to adjust your docker run command to expose a port if you want to access it.
If you follow the docker-compose setup it does all of these things, instead of you having to figure every little thing out by yourself.

same nothing in port 10000
docker run -p 10000 owncloud/server

pi@lucas:~ $ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
626239e92e84 owncloud/server “/usr/bin/entrypoint…” About a minute ago Up About a minute 8080/tcp, 0.0.0.0:32776->10000/tcp eloquent_hertz

sudo curl -L “https://github.com/docker/compose/releases/download/1.25.3/docker-compose-(uname -s)-(uname -m)” -o /usr/local/bin/docker-compose

need help docker-compose does not install with this command

You need to learn docker and how it deals with ports.
As you see the container itself is using already port 8080, but that one is not published.

Just exposing a random port on a random host port, is also not going to start to work magically. Currently if you connect to localhost:32776 this will forward the connection to port 10000 inside the container. But is your service inside your container configured to listen on port 10000?

By default the owncloud docker container’s apache is configured to listen on port 8080. The container is configured to expose port 8080 on it’s local IP address. And if you publish that port on some host port you will be able to connect to it with your browser by typing localhost:<host port>.

Otherwise you’ll only be able to connect if you get the docker container’s IP address like so (needs jq):

docker inspect <your owncloud docker container name/id> | jq '.[].NetworkSettings.Networks[].IPAddress'
#If you don't want to install jq you can also just grep for the string
docker inspect <your owncloud docker container name/id> | grep IPA

what i dont understand why i am missing docker-compose

pi@lucas:~ docker-compose --version bash: docker-compose: command not found pi@lucas:~ docker --version
Docker version 19.03.6, build 369ce74
pi@lucas:~ $

this tutorial does not mentioned how to get docker-compose

Maybe you want stick to the official ownCloud documentation: https://doc.owncloud.com/server/admin_manual/installation/docker/
docker-compose is handled in the document you linked before as well: https://owncloud.org/news/how-to-set-up-an-owncloud-in-3-minutes/

Docker-compose is a separate installation beside docker itself.

i tried all 3 options on trying to get docker -compose
pip failed
and so did

pi@lucas:~/owncloud-docker-server sudo curl -L --fail https://github.com/docker/compose/releases/download/1.25.4/run.sh -o /usr/local/bin/docker-compose % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 596 100 596 0 0 2257 0 --:--:-- --:--:-- --:--:-- 2266 100 1789 100 1789 0 0 3079 0 --:--:-- --:--:-- --:--:-- 3079 pi@lucas:~/owncloud-docker-server sudo docker-compose up -d
sudo: docker-compose: command not found
pi@lucas:~/owncloud-docker-server sudo chmod +x /usr/local/bin/docker-compose pi@lucas:~/owncloud-docker-server sudo docker-compose up -d
Unable to find image ‘docker/compose:1.25.4’ locally
1.25.4: Pulling from docker/compose
89d9c30c1d48: Pull complete
eccc02a3b135: Pull complete
7382d3c5d78f: Pull complete
f410c750fbcb: Pull complete
Digest: sha256:390bdf3da99a622f5c11f4db386dd97f2858db30cfed07d000b867f1fb25b2f7
Status: Downloaded newer image for docker/compose:1.25.4
standard_init_linux.go:211: exec user process caused “exec format error”
pi@lucas:~/owncloud-docker-server $ docker-compose ps
standard_init_linux.go:211: exec user process caused “exec format error”

So it turns out is built for for armv6 and not arm32v .