FROM nextcloud:latest
RUN apt-get update && apt-get install -y procps smbclient && rm -rf /var/lib/apt/lists/*
Nextcloud starts successfully, and I am able to access the web interface and perform initial set up. I have also been able to access the front end via a Nginx Proxy Manager defined subdomain.
What I want to happen is to issue the command docker-compose up --detach and the image to be pulled and installed and then the dockerfile to be executed to install various addons. I can’t find any documentation on how to do this.
There are some dockerfile examples on the official github page but there are no examples of how to implement these. There are no dockerfile results when searching in the official documents, either.
I’m looking for something that I can turn into configuration as code to ensure this is repeatable. Any guidance or suggestions?
this snippet of docker-compose.yml file will build a service nextcloud from the Dockerfile inside of subdirectory ./nextcloud located in $PWD once you run docker-compose up
you should not do this as changes within existing container are not persistent and lost if you rebuild it. You should rather use Dockerfile as in the sample above using official examples provided on docker hub…
I have a .env file with the following name/value pairs:
APPDATA=/srv/nextcloud
PASSWORD=[password]
I have a Dockerfile with the following contents:
FROM nextcloud:latest
RUN apt-get update && apt-get install -y procps smbclient && rm -rf /var/lib/apt/lists/*
The following commands are issued:
$ sudo docker-compose up --detach
Creating network "nextcloud_default" with the default driver
Building nextcloud
Sending build context to Docker daemon 687.1MB
Step 1/2 : FROM nextcloud:latest
[...]
Step 2/2 : RUN apt-get update && apt-get install -y procps smbclient && rm -rf /var/lib/apt/lists/*
[...]
WARNING: Image for service nextcloud was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
Creating nextcloud ... done
Creating nextcloud_mysql ... done
Now when I access my Nextcloud host, I can see that the smbclient has been installed. This works, and will support upgrades!