Giter Club home page Giter Club logo

Comments (8)

wom-bat avatar wom-bat commented on July 1, 2024 1

Just use TZ. It's meant to be there (POSIX standard). /etc/localtime is a GNU extension that makes things faster if it's there.

from sel4-camkes-l4v-dockerfiles.

lsf37 avatar lsf37 commented on July 1, 2024

It does appear that passing the time zone via TZ as an environment variable is more stable than trying to link the time zone file directly.

The main question is how to reliably get the time zone string from the host OS. On reasonably recent Debian, Ubuntu, and MacOS at least, the /etc/localtime link seems to always exist, so we could try to extract it from that.

Ubuntu and Debian both seem to support reading /etc/timezone which for me both report the correct string Australia/Sydney. I think Debian also sets TZ. So we could do the following in decreasing priority

  • check TZ env, if set use that
  • check /etc/timezone, if the file exists use its contents
  • check for MacOS, if yes, strip /var/db/timezone/zoneinfo/ from the link in /etc/localtime
  • otherwise print a warning that time zone is not set

from sel4-camkes-l4v-dockerfiles.

lsf37 avatar lsf37 commented on July 1, 2024

We could also delete the symlink in the container, of course. Not sure if that throws anything into disarray.

from sel4-camkes-l4v-dockerfiles.

lsf37 avatar lsf37 commented on July 1, 2024

TZ is unfortunately not set on most platforms I tried (in fact, it was set only on Debian). It works when I set it in the container, but my main problem is trying to get the correct time zone string from the host.

from sel4-camkes-l4v-dockerfiles.

LukeMondy avatar LukeMondy commented on July 1, 2024

Yes, adding MacOS support was a real spanner in the works, unfortunately :(

What does the /usr/share/zoneinfo.default/Australia/Sydney file (or folder) look like on the host?

Otherwise, your bullet point list of options sounds fair enough.

from sel4-camkes-l4v-dockerfiles.

lsf37 avatar lsf37 commented on July 1, 2024

For the timezone file itself I get the following on MacOS:

ls -l /usr/share/zoneinfo.default/Australia/Sydney 
-rw-r--r--  4 root  wheel  2195 28 Oct 19:43 /usr/share/zoneinfo.default/Australia/Sydney

Before I try all that extraction stuff, I'll give it the old method another shot by deleting the symbolic link in the docker container so that there is no conflict when docker is trying to mount there. Peter mentioned that if the file/link does not exist it's just going to default to UTC which is what it's already doing anyway, so there should be no additional adverse effects if the mount command doesn't work for some reason.

from sel4-camkes-l4v-dockerfiles.

Willmish avatar Willmish commented on July 1, 2024

Hi all, also run into the wall of getting the docker image up and running on an M1 Mac, I've set the environment var export DOCKER_BUILDKIT=0 (ran into the same issue as #40 , when pulling extras image), but I believe I have arrived at the same issue as this one describes:

When running make user, fails at:

docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting "/usr/share/zoneinfo.default/Europe/London" to rootfs at "/etc/localtime": mount /usr/share/zoneinfo.default/Europe/London:/etc/localtime (via /proc/self/fd/9), flags: 0x5001: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type.
make: *** [Makefile:131: user_run] Error 125```

from sel4-camkes-l4v-dockerfiles.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.