I've started of with the Dockerfile from Owncloud in home directory and modified it for my needs:
FROM ubuntu:17.04It just installs the needed files and has a shell as its running command.
RUN \
apt-get update && \
apt-get -y upgrade && \
apt-get install -y lighttpd && \
apt-get install -y php-fpm && \
apt-get install -y crudini && \
apt-get install -y php7.0-sqlite php-curl php-gd php-zip php7.0-xml php7.0-mbstring
RUN crudini --set /etc/php/7.0/fpm/php.ini PHP cgi.fix_pathinfo 1
RUN apt-get remove -y crudini && apt-get clean
CMD ["/bin/sh"]
To build it I've used this command
docker build -t base_image_owncloud:1.0 .
Then I've started the container with
docker run base_image_owncloud:1.0
looked up the container id with
docker ps -a
and exported it with
docker export -o base_owncloud.tar b51aad335f21
This gave me a base_owncloud.tar file that I've downloaded at my computer. I've put the extracted files alongside my Ownlcould installation as I didn't want to mix the files or change the Owncloud setup.
To use the runtime files I've used unshare with root id and pid and mount namespaces. Then I've mount binded the Owncloud setup to the correct location in the runtime and made a chroot so that my runtime would be the new root. This created a nice container but still wouldn't run my Owncloud container as I've stumbled on another problem that will be topic of the next blog post.
This post is part of a series:
- Owncloud in a container
- Container and namespaces
- Getting the runtime files
- Device files
- Putting all together