├── rc.local ├── 001-owncloud.conf ├── Dockerfile ├── LICENSE └── README.md /rc.local: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [ ! -z "$MYSQL_PORT_3306_TCP_ADDR" ]; then 3 | sed -i "s/.*dbhost.*/ 'dbhost' => '$MYSQL_PORT_3306_TCP_ADDR',/" /var/www/owncloud/config/config.php 4 | fi 5 | service apache2 start 6 | -------------------------------------------------------------------------------- /001-owncloud.conf: -------------------------------------------------------------------------------- 1 | 2 | ServerAdmin webmaster@localhost 3 | DocumentRoot /var/www/owncloud 4 | 5 | Options FollowSymLinks 6 | AllowOverride None 7 | 8 | 9 | Options Indexes FollowSymLinks MultiViews 10 | AllowOverride All 11 | Order allow,deny 12 | allow from all 13 | 14 | ErrorLog ${APACHE_LOG_DIR}/error.log 15 | LogLevel warn 16 | 17 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM phusion/baseimage:latest 2 | MAINTAINER Brendan Tobolaski "brendan@tobolaski.com" 3 | ENV OC_VERSION 8.2.1 4 | RUN apt-get -y update 5 | RUN apt-get install -y apache2 php5 php5-gd php-xml-parser php5-intl php5-mysqlnd php5-json php5-mcrypt smbclient curl libcurl3 php5-curl bzip2 wget 6 | RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* 7 | 8 | RUN rm -rf /etc/service/sshd /etc/my_init.d/00_regen_ssh_host_keys.sh 9 | 10 | RUN curl -k https://download.owncloud.org/community/owncloud-$OC_VERSION.tar.bz2 | tar jx -C /var/www/ 11 | RUN mkdir /var/www/owncloud/data 12 | RUN chown -R www-data:www-data /var/www/owncloud 13 | 14 | ADD ./001-owncloud.conf /etc/apache2/sites-available/ 15 | RUN rm -f /etc/apache2/sites-enabled/000* 16 | RUN ln -s /etc/apache2/sites-available/001-owncloud.conf /etc/apache2/sites-enabled/ 17 | RUN a2enmod rewrite 18 | 19 | ADD rc.local /etc/rc.local 20 | RUN chown root:root /etc/rc.local 21 | 22 | VOLUME ["/var/www/owncloud/data", "/var/www/owncloud/config"] 23 | EXPOSE 80 24 | CMD ["/sbin/my_init"] 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Brendan Tobolaski 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This builds a docker container with owncloud running in it. It uses a docker volume in order to allow you to persist the data between different containers. It is setup for mysql but, it does not have a linked mysql container. This is because I prefer to run mysql outside of docker but, pull requests are always welcome. 2 | 3 | # Usage # 4 | 5 | ## Building the image ## 6 | 7 | run `docker build -t 'name/owncloud' .` 8 | 9 | ## Running ## 10 | 11 | 1. You'll either need to build the image or pull `btobolaski/owncloud`. 12 | 2. Run it `docker run -d -m 1g -p 127.0.0.1:9000:80 --name="owncloud" -v /var/owncloud/data:/var/www/owncloud/data -v /var/owncloud/config:/var/www/owncloud/config btobolaski/owncloud` 13 | 3. Setup a reverse proxy to it 14 | 15 | ``` 16 | server { 17 | listen 80; 18 | server_name owncloud.example.com; 19 | return 301 https://$host$request_uri; 20 | } 21 | 22 | server { 23 | listen 443; 24 | server_name owncloud.example.com; 25 | ssl on; 26 | ssl_certificate /etc/ssl/private/example_com.cert; 27 | ssl_certificate_key /etc/ssl/private/example_com.key; 28 | location / { 29 | proxy_pass http://127.0.0.1:9000; 30 | proxy_redirect off; 31 | proxy_buffering off; 32 | proxy_set_header Host $host; 33 | proxy_set_header X-Real-IP $remote_addr; 34 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 35 | } 36 | }``` 37 | --------------------------------------------------------------------------------