Almost There - OwnCloud in Docker

Hello All. Tried OwnCloud via a Docker Container in Docker Desktop for Mac. I like it. I decided to install on my Debian 10 server running the latest version of Docker. I have other containers running so Docker itself appears to be installed correctly as far as I can tell.

The install is based upon the instructions provided here:

The docker-compose.yml file was from the suggest source in the article.

Now here’s where it gets confusing to me. It references putting some environmental variables in a .env file. Specifically (modified for my situation):

# Specify some settings via environment variables, save them in .env
cat << EOF >| .env
OWNCLOUD_VERSION=10.8
OWNCLOUD_DOMAIN=localhost
ADMIN_USERNAME=admin
ADMIN_PASSWORD=admin
HTTP_PORT=8080
HTTPS_PORT=443
EOF

Never having used a .env file before…is that it’s complete name “.env”? Is it to be located in the same directory as the YML file…I would assume so.

The YML file is as follows:

version: "3"


volumes:
  files:
    driver: local
  mysql:
    driver: local
  redis:
    driver: local

services:
  owncloud:
    image: owncloud/server:${latest}
    container_name: owncloud_server
    restart: always
    ports:
      - ${HTTP}:8080
    depends_on:
      - mariadb
      - redis
    environment:
      - OWNCLOUD_DOMAIN=${localhost:8080}
      - OWNCLOUD_DB_TYPE=mysql
      - OWNCLOUD_DB_NAME=owncloud
      - OWNCLOUD_DB_USERNAME=owncloud
      - OWNCLOUD_DB_PASSWORD=owncloud
      - OWNCLOUD_DB_HOST=mariadb
      - OWNCLOUD_ADMIN_USERNAME=${admin}
      - OWNCLOUD_ADMIN_PASSWORD=${admin}
      - OWNCLOUD_MYSQL_UTF8MB4=true
      - OWNCLOUD_REDIS_ENABLED=true
      - OWNCLOUD_REDIS_HOST=redis



    healthcheck:
      test: ["CMD", "/usr/bin/healthcheck"]
      interval: 30s
      timeout: 10s
      retries: 5
    volumes:
      - files:/mnt/data

  mariadb:
    image: mariadb:10.5
    container_name: owncloud_mariadb
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=owncloud
      - MYSQL_USER=owncloud
      - MYSQL_PASSWORD=owncloud
      - MYSQL_DATABASE=owncloud
    command: ["--max-allowed-packet=128M", "--innodb-log-file-size=64M"]
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-u", "root", "--password=owncloud"]
      interval: 10s
      timeout: 5s
      retries: 5
    volumes:
      - mysql:/var/lib/mysql

  redis:
    image: redis:6
    container_name: owncloud_redis
    restart: always
    command: ["--databases", "1"]
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 5s
      retries: 5
    volumes:
      - redis:/data

When I run “docker-compose up -d” I get these errors:

I’ve done my homework but being new to OwnCloud and Docker, I’m not seeing the problem or the solution. I would appreciate your help.

Thank you.

Hi, for better readability, please use code blocks next time.

It looks like you have modified the original docker-compose file e.g. image: owncloud/server:${latest} and that’s what is causing the issue. You don’t need to modify the docker-compose file, just adjust the environment variable values in your .env file.

Never having used a .env file before…is that it’s complete name “.env”? Is it to be located in the same directory as the YML file…I would assume so.

Correct, the file need to be named .env and must be placed right beside the downloaded docker-compose file. For more details, see Environment variables in Compose | Docker Documentation

1 Like

Thank you for your reply. I brought in a fresh copy of docker-compose.yml from github with no changes. I created the .env file with desired variables then initiated docker-compose up -d.

Received 1 warning message but otherwise the installation ran to completion and the instance of OwnCloud is operating. I logged in with the default admin ID and have uploaded files and playlists.

The warning message was:

The .env file looks like this:

cat << EOF >| .env
OWNCLOUD VERSION=10.8
OWNCLOUD DOMAIN=localhost
ADMIN USERNAME=admin
ADMIN PASSWORD=admin
HTTP PORT=8080
HTTPS PORT=443
EOF

As I’d like to have a no error / no warning install, what is the Warning telling me and what is the corrective action? If this a version number error?

Thank you very much!

It is already progress as the interpolation error and “variable not set” warnings are gone :slight_smile:

Do you really have the line cat << EOF >| .env inside your .env file if you open it in an editor? In this case, you have to remove it (remove the first and the last line completely). The content should look like this:

OWNCLOUD_VERSION=10.8
OWNCLOUD_DOMAIN=localhost
ADMIN_USERNAME=admin
ADMIN_PASSWORD=admin
HTTP_PORT=8080
HTTPS_PORT=443

The cat << EOF thing is meant to be pasted to your terminal to automatically create the .env file with the desired config, see linux - What does <<EOF do? - Super User

2 Likes

Thank you for your reply.

Yes, “cat << EOF >| .env” was in the .env file. Per your guidance, I have removed the first and last lines.

Now all of the errors/warnings are gone!! Thank you for your excellent guidance!

Gary

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.