This happens because the rock-on logic adds a read-only mapping of host’s /etc/localtime to all containers by default. Ideally, we shouldn’t be heavily configuring at the container level like we do here. Don’t get me wrong, I love this guide, but a docker preferred way is to bake new image with most/all configuration. Anyway, now to the workaround…
To get around this problem, do the following
- Stop the docker-daemon/rock-on service with
systemctl stop docker
- Locate these two files at /mnt2/[rockon-root]/containers/[containerid]/{config.json,hostconfig.json}
- edit those two files and remove all references to /etc/localtime mappings. Here are the before and after snapshots of relevant sections
# colordiff hostconfig.json ~/hostconfig.json
1c1
< {"Binds":["/mnt2/share123:/var/www/html"],"ContainerIDFile":"","LxcConf":[],"Memory":0,"MemoryReservation":0,"MemorySwap":0,"KernelMemory":0,"CpuShares":0,"CpuPeriod":0,"CpusetCpus":"","CpusetMems":"","CpuQuota":0,"BlkioWeight":0,"OomKillDisable":false,"MemorySwappiness":-1,"Privileged":false,"PortBindings":{"443/tcp":[{"HostIp":"","HostPort":"8445"}],"443/udp":[{"HostIp":"","HostPort":"8445"}]},"Links":null,"PublishAllPorts":false,"Dns":[],"DnsOptions":[],"DnsSearch":[],"ExtraHosts":null,"VolumesFrom":null,"Devices":[],"NetworkMode":"default","IpcMode":"","PidMode":"","UTSMode":"","CapAdd":null,"CapDrop":null,"GroupAdd":null,"RestartPolicy":{"Name":"unless-stopped","MaximumRetryCount":0},"SecurityOpt":null,"ReadonlyRootfs":false,"Ulimits":null,"LogConfig":{"Type":"","Config":{}},"CgroupParent":"","ConsoleSize":[0,0],"VolumeDriver":""}
\ No newline at end of file
---
> {"Binds":["/mnt2/share123:/var/www/html","/etc/localtime:/etc/localtime:ro"],"ContainerIDFile":"","LxcConf":[],"Memory":0,"MemoryReservation":0,"MemorySwap":0,"KernelMemory":0,"CpuShares":0,"CpuPeriod":0,"CpusetCpus":"","CpusetMems":"","CpuQuota":0,"BlkioWeight":0,"OomKillDisable":false,"MemorySwappiness":-1,"Privileged":false,"PortBindings":{"443/tcp":[{"HostIp":"","HostPort":"8445"}],"443/udp":[{"HostIp":"","HostPort":"8445"}]},"Links":null,"PublishAllPorts":false,"Dns":[],"DnsOptions":[],"DnsSearch":[],"ExtraHosts":null,"VolumesFrom":null,"Devices":[],"NetworkMode":"default","IpcMode":"","PidMode":"","UTSMode":"","CapAdd":null,"CapDrop":null,"GroupAdd":null,"RestartPolicy":{"Name":"unless-stopped","MaximumRetryCount":0},"SecurityOpt":null,"ReadonlyRootfs":false,"Ulimits":null,"LogConfig":{"Type":"","Config":{}},"CgroupParent":"","ConsoleSize":[0,0],"VolumeDriver":""}
\ No newline at end of file
# colordiff config.json ~/config.json
1c1
< {"State":{"Running":true,"Paused":false,"Restarting":false,"OOMKilled":false,"Dead":false,"Pid":17753,"ExitCode":0,"Error":"","StartedAt":"2016-12-03T14:58:56.965629219Z","FinishedAt":"2016-12-03T14:45:17.638967978Z"},"ID":"bb9a51bb52f6917c65c1d30f4bcd907681ca449c532068069a7085f5fef61b72","Created":"2016-12-03T13:02:52.273259407Z","Path":"/entrypoint.sh","Args":["apache2-foreground"],"Config":{"Hostname":"bb9a51bb52f6","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"ExposedPorts":{"443/tcp":{},"443/udp":{},"80/tcp":{}},"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","PHPIZE_DEPS=autoconf \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkg-config \t\tre2c","PHP_INI_DIR=/usr/local/etc/php","APACHE_CONFDIR=/etc/apache2","APACHE_ENVVARS=/etc/apache2/envvars","PHP_EXTRA_BUILD_DEPS=apache2-dev","PHP_EXTRA_CONFIGURE_ARGS=--with-apxs2","GPG_KEYS=0BD78B5F97500D450838F95DFE857D9A90D90EC1 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3","PHP_VERSION=5.6.28","PHP_URL=https://secure.php.net/get/php-5.6.28.tar.xz/from/this/mirror","PHP_ASC_URL=https://secure.php.net/get/php-5.6.28.tar.xz.asc/from/this/mirror","PHP_SHA256=07187ba2870f89cef334cd2ad6cb801aeec5eaf283da0293a9a6be75d6786d11","PHP_MD5=1e01c66b2e67ab3b56a6180ee560fe4c","OWNCLOUD_VERSION=9.1.2"],"Cmd":["apache2-foreground"],"Image":"owncloud","Volumes":{"/var/www/html":{}},"WorkingDir":"/var/www/html","Entrypoint":["/entrypoint.sh"],"OnBuild":null,"Labels":{},"StopSignal":"SIGTERM"},"Image":"be5ebe1228116706f8496830f2c80bc584f8f9edd6818e3c1a2f8a2c3b103bc4","NetworkSettings":{"Bridge":"","SandboxID":"c14d568249783df86799db337fceb2b77218c0e2977707e8de9340a196c18ce9","HairpinMode":false,"LinkLocalIPv6Address":"","LinkLocalIPv6PrefixLen":0,"Networks":{"bridge":{"EndpointID":"b9572291cabe60aa51543f95e9b57fcd4e5ee1c6577d77e295bfaf8d10bc12bf","Gateway":"172.17.0.1","IPAddress":"172.17.0.2","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":"02:42:ac:11:00:02"}},"Ports":{"443/tcp":[{"HostIp":"0.0.0.0","HostPort":"8445"}],"443/udp":[{"HostIp":"0.0.0.0","HostPort":"8445"}],"80/tcp":null},"SandboxKey":"/var/run/docker/netns/c14d56824978","SecondaryIPAddresses":null,"SecondaryIPv6Addresses":null,"IsAnonymousEndpoint":false},"LogPath":"","Name":"/owncloudHTTPS","Driver":"btrfs","ExecDriver":"native-0.2","MountLabel":"","ProcessLabel":"","RestartCount":14,"HasBeenStartedBefore":false,"HasBeenManuallyStopped":false,"AppArmorProfile":"","HostnamePath":"/mnt2/rockon-root/containers/bb9a51bb52f6917c65c1d30f4bcd907681ca449c532068069a7085f5fef61b72/hostname","HostsPath":"/mnt2/rockon-root/containers/bb9a51bb52f6917c65c1d30f4bcd907681ca449c532068069a7085f5fef61b72/hosts","ShmPath":"/mnt2/rockon-root/containers/bb9a51bb52f6917c65c1d30f4bcd907681ca449c532068069a7085f5fef61b72/shm","MqueuePath":"/mnt2/rockon-root/containers/bb9a51bb52f6917c65c1d30f4bcd907681ca449c532068069a7085f5fef61b72/mqueue","MountPoints":{"/var/www/html":{"Name":"","Destination":"/var/www/html","Driver":"","RW":true,"Source":"/mnt2/share123","Relabel":""}},"ResolvConfPath":"/mnt2/rockon-root/containers/bb9a51bb52f6917c65c1d30f4bcd907681ca449c532068069a7085f5fef61b72/resolv.conf","Volumes":{"/var/www/html":"/mnt2/share123"},"VolumesRW":{"/var/www/html":true}}
\ No newline at end of file
---
> {"State":{"Running":false,"Paused":false,"Restarting":false,"OOMKilled":false,"Dead":false,"Pid":0,"ExitCode":0,"Error":"","StartedAt":"2016-12-03T13:02:52.765204987Z","FinishedAt":"2016-12-03T13:50:43.463390822Z"},"ID":"bb9a51bb52f6917c65c1d30f4bcd907681ca449c532068069a7085f5fef61b72","Created":"2016-12-03T13:02:52.273259407Z","Path":"/entrypoint.sh","Args":["apache2-foreground"],"Config":{"Hostname":"bb9a51bb52f6","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"ExposedPorts":{"443/tcp":{},"443/udp":{},"80/tcp":{}},"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","PHPIZE_DEPS=autoconf \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkg-config \t\tre2c","PHP_INI_DIR=/usr/local/etc/php","APACHE_CONFDIR=/etc/apache2","APACHE_ENVVARS=/etc/apache2/envvars","PHP_EXTRA_BUILD_DEPS=apache2-dev","PHP_EXTRA_CONFIGURE_ARGS=--with-apxs2","GPG_KEYS=0BD78B5F97500D450838F95DFE857D9A90D90EC1 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3","PHP_VERSION=5.6.28","PHP_URL=https://secure.php.net/get/php-5.6.28.tar.xz/from/this/mirror","PHP_ASC_URL=https://secure.php.net/get/php-5.6.28.tar.xz.asc/from/this/mirror","PHP_SHA256=07187ba2870f89cef334cd2ad6cb801aeec5eaf283da0293a9a6be75d6786d11","PHP_MD5=1e01c66b2e67ab3b56a6180ee560fe4c","OWNCLOUD_VERSION=9.1.2"],"Cmd":["apache2-foreground"],"Image":"owncloud","Volumes":{"/var/www/html":{}},"WorkingDir":"/var/www/html","Entrypoint":["/entrypoint.sh"],"OnBuild":null,"Labels":{},"StopSignal":"SIGTERM"},"Image":"be5ebe1228116706f8496830f2c80bc584f8f9edd6818e3c1a2f8a2c3b103bc4","NetworkSettings":{"Bridge":"","SandboxID":"","HairpinMode":false,"LinkLocalIPv6Address":"","LinkLocalIPv6PrefixLen":0,"Networks":{"bridge":{"EndpointID":"","Gateway":"","IPAddress":"","IPPrefixLen":0,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"MacAddress":""}},"Ports":null,"SandboxKey":"","SecondaryIPAddresses":null,"SecondaryIPv6Addresses":null,"IsAnonymousEndpoint":false},"LogPath":"","Name":"/owncloudHTTPS","Driver":"btrfs","ExecDriver":"native-0.2","MountLabel":"","ProcessLabel":"","RestartCount":0,"HasBeenStartedBefore":false,"HasBeenManuallyStopped":true,"AppArmorProfile":"","HostnamePath":"/mnt2/rockon-root/containers/bb9a51bb52f6917c65c1d30f4bcd907681ca449c532068069a7085f5fef61b72/hostname","HostsPath":"/mnt2/rockon-root/containers/bb9a51bb52f6917c65c1d30f4bcd907681ca449c532068069a7085f5fef61b72/hosts","ShmPath":"/mnt2/rockon-root/containers/bb9a51bb52f6917c65c1d30f4bcd907681ca449c532068069a7085f5fef61b72/shm","MqueuePath":"/mnt2/rockon-root/containers/bb9a51bb52f6917c65c1d30f4bcd907681ca449c532068069a7085f5fef61b72/mqueue","MountPoints":{"/etc/localtime":{"Name":"","Destination":"/etc/localtime","Driver":"","RW":false,"Source":"/etc/localtime","Relabel":"ro"},"/var/www/html":{"Name":"","Destination":"/var/www/html","Driver":"","RW":true,"Source":"/mnt2/share123","Relabel":""}},"ResolvConfPath":"/mnt2/rockon-root/containers/bb9a51bb52f6917c65c1d30f4bcd907681ca449c532068069a7085f5fef61b72/resolv.conf","Volumes":{"/etc/localtime":"/etc/localtime","/var/www/html":"/mnt2/share123"},"VolumesRW":{"/etc/localtime":false,"/var/www/html":true}}
\ No newline at end of file
- systemctl start docker
If all goes well, your owncloud container should be back up and you can bash into it and won’t have problems when apt tries to move /etc/localtime file around.