ailispaw / boot2docker-xhyve

Boot2Docker running on xhyve hypervisor
294 stars 25 forks source link

/etc/localtime is a directory, not a file #21

Closed niloc132 closed 9 years ago

niloc132 commented 9 years ago

By itself this isn't a problem (and given xhyve's issues with maintaining correct time after the host sleeps, may not actually matter for some time yet), but it does mess with some docker-compose wiring that we're doing to ensure that real servers keep consistent timezones with their hosts.

The base image that boot2docker-xhyve is based on should have a file at /etc/localtime, not a directory. http://man7.org/linux/man-pages/man5/localtime.5.html

[colin@trymon boot2docker-xhyve (master)]$ make clean
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C uuid2ip clean
rm -f .mac_address
rm -f initrd.img vmlinuz64
rm -f boot2docker.iso
rm -f boot2docker-data.img
rm -f boot2docker-data.tar.gz
[colin@trymon boot2docker-xhyve (master)]$ make
curl -OL https://github.com/timfallmk/boot2docker/releases/download/v1.8.1/boot2docker.iso
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   578    0   578    0     0   1250      0 --:--:-- --:--:-- --:--:--  1248
100 28.0M  100 28.0M    0     0  1480k      0  0:00:19  0:00:19 --:--:-- 1630k
hdiutil mount boot2docker.iso
/dev/disk6                                              /Volumes/Boot2Docker-v1.8
cp /Volumes/Boot2Docker-v1.8/boot/initrd.img . && sync
hdiutil unmount /Volumes/Boot2Docker-v1.8
"/Volumes/Boot2Docker-v1.8" unmounted successfully.
hdiutil mount boot2docker.iso
/dev/disk6                                              /Volumes/Boot2Docker-v1.8
cp /Volumes/Boot2Docker-v1.8/boot/vmlinuz64 . && sync
hdiutil unmount /Volumes/Boot2Docker-v1.8
"/Volumes/Boot2Docker-v1.8" unmounted successfully.
curl -OL https://github.com/ailispaw/boot2docker-xhyve/releases/download/v0.6.0/boot2docker-data.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   585    0   585    0     0    636      0 --:--:-- --:--:-- --:--:--   636
100 4084k  100 4084k    0     0   785k      0  0:00:05  0:00:05 --:--:-- 1106k
tar zxvf boot2docker-data.tar.gz
x boot2docker-data.img
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C uuid2ip
cc main.c
ld uuid2mac.sym
dsym uuid2mac.dSYM
strip uuid2mac
[colin@trymon boot2docker-xhyve (master)]$ make run
Booting up...
tab 1 of window id 14807
[colin@trymon boot2docker-xhyve (master)]$ docker run -v /etc/localtime:/etc/localtime:ro -it --rm mongo bash
Unable to find image 'mongo:latest' locally
latest: Pulling from library/mongo

b1d080d9151f: Pull complete 
59a090c1706e: Pull complete 
f53919fe149a: Pull complete 
c269a0ead17c: Pull complete 
26dcb1a49c4a: Pull complete 
b9d2e7e8c9ff: Pull complete 
43acddfebe5b: Pull complete 
510a7c497746: Pull complete 
fefaf29784b7: Pull complete 
2d187f187955: Pull complete 
fe0d7236a147: Pull complete 
bf4514e79915: Pull complete 
d939f57bf29c: Pull complete 
5f9d083f5bfb: Pull complete 
2c273afa05c0: Pull complete 
958ba566c40a: Pull complete 
5e53867deb23: Pull complete 
library/mongo:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security.

Digest: sha256:76fdd96ebcdece6a38b4caffc6e2fabf4e1934e944c792269b497f3edfeaa376
Status: Downloaded newer image for mongo:latest
Error response from daemon: Cannot start container 7c052ef5cd148dc94a16a4ae86af79b5bd03fff1a0a45881edddadd773976b01: [8] System error: not a directory
[colin@trymon boot2docker-xhyve (master)]$ 

Workaround:

[colin@trymon boot2docker-xhyve (master)]$ make ssh
docker@192.168.64.2's password: 
                        ##         .
                  ## ## ##        ==
               ## ## ## ## ##    ===
           /"""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ /  ===- ~~~
           \______ o           __/
             \    \         __/
              \____\_______/
 _                 _   ____     _            _
| |__   ___   ___ | |_|___ \ __| | ___   ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__|   <  __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
Boot2Docker version 1.8.1, build xhyve : e9e034e - Fri Sep  4 20:35:54 UTC 2015
Docker version 1.8.1, build d12ea79
docker@boot2docker:~$ sudo rm -rf /etc/localtime/
docker@boot2docker:~$ sudo touch /etc/localtime
docker@boot2docker:~$ ^D
[colin@trymon boot2docker-xhyve (master)]$ docker run -v /etc/localtime:/etc/localtime:ro -it --rm mongo bash
root@3bab6adb227a:/# 
ailispaw commented 9 years ago

I don't touch anything in /etc of the original boot2docker. Can you do it with the original boot2docker?

ailispaw commented 9 years ago

BTW, I can not see /etc/localtime at all right after the first boot. I think just sudo touch /etc/localtime is all you need.

You can put sudo touch /etc/localtime in the /var/lib/boot2docker/bootsync.sh for every boot.

ailispaw commented 9 years ago

@niloc132 I found a similar issue at https://github.com/boot2docker/boot2docker/issues/891. It should be fixed in the boot2docker itself.

niloc132 commented 9 years ago

Thanks for the very prompt response @ailispaw, I'll close this and watch that issue instead.