Coder Social home page Coder Social logo

Comments (11)

glerchundi avatar glerchundi commented on August 22, 2024

Can you explain a little bit more? Or give a full example in order to assess if it's worth it or not?

from s6-overlay.

analogic avatar analogic commented on August 22, 2024

Better example: service wont run without log directory - for ex. nginx. I mount volume /var/log - for first time its completely empty and directory /var/log/nginx is missing, nginx wont run until i create it with proper rights.

  1. it would be nice to have some flag in fix-attrs, which will automaticaly run mkdir -p /var/log/nginx if directory not exists
  2. or/and have ability to run a script BEFORE fix-attrs which will run mkdir -p /var/log/nginx

from s6-overlay.

analogic avatar analogic commented on August 22, 2024

I would post a patch but execlineb is not my favorite language yet :)

from s6-overlay.

glerchundi avatar glerchundi commented on August 22, 2024

@analogic sorry for the delay, right now, i don't have much time to invest on the overlay. Have you thought on making them in your container before building it up?

Something like this (take a look to /var/log/{nginx-access-logs,nginx-error-logs}): https://github.com/just-containers/nginx-loadbalancer

WDYT?

from s6-overlay.

glerchundi avatar glerchundi commented on August 22, 2024

@analogic any news on this?

from s6-overlay.

analogic avatar analogic commented on August 22, 2024

Sorry for delay - nginx was only for example - there are other services which needs precreate directories with proper rights. I am author of https://hub.docker.com/r/analogic/poste.io/ and handling directories which are exposed to users is kind of complex task. :) I will write patch when i will have some time...

from s6-overlay.

glerchundi avatar glerchundi commented on August 22, 2024

My nginx references were an example too. I pre-create folders within the rootfs before building the image itself, it's more declarative and seems cleaner, at least for me. Give it a try and tell me what you think and if this doesn't fit explain your use-case a little bit more. Image sources would help of course.

from s6-overlay.

analogic avatar analogic commented on August 22, 2024

Technicaly my image is blackbox with only datadir/logs exposed via volumes - rootfs is not problem at all. Mainly i am solving first container run (precreating needed directories), fixing user errors (deletion some of a logs dir) or updates in datadir structure... its no big deal, but it would be nice to switch all this handling from custom script to simple fix-attrs

from s6-overlay.

glerchundi avatar glerchundi commented on August 22, 2024

What about something like this (this is the way it was done in nginx-loadbalancer):

mysql-data-image/Dockerfile:

FROM busybox
VOLUME /var/lib/mysql
COPY rootfs /
CMD ["true"]

mysql-data-image/rootfs/var/lib/mysql/test-file:

buh from a data container

Then:

  1. docker build -t mysql-data-image .
  2. docker run --name mysql-data mysql-data-image
  3. docker run --rm --volumes-from mysql-data quay.io/justcontainers/mariadb:v0.4.0 cat /var/lib/mysql/test-file

Among other things this is printed to the stdout:

[...]
buh from a data container
cat exited 0
[...]

from s6-overlay.

glerchundi avatar glerchundi commented on August 22, 2024

@analogic please close this whenever you can.

from s6-overlay.

analogic avatar analogic commented on August 22, 2024

sorry, i am bit busy right now... ill do patch later

from s6-overlay.

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.