GithubHelp home page GithubHelp logo

Detach? about vessel HOT 4 CLOSED

prologic avatar prologic commented on May 27, 2024
Detach?

from vessel.

Comments (4)

prologic avatar prologic commented on May 27, 2024 2

Hi @0xc0d 👋 I wanted to let you know that I eventually managed to fix support for running containers detached with a -d/--detach flag. See this PR and attached screenshot showing this working 👌

In the end I had to:

  1. Ensure important devices such as /dev/null were available in the container's filesystem. So I borrowed some code from GoNix to do this CreateDevices() once we're inside the new container's namespace and filesystem.
  2. Set the SysProcAttr(s) Pgid: 0 and Setpgid: true in the parent process of the container -- That is run.go for me (probably similar for you)
  3. Ensure that the container process (_the forked or init process, which for me is in fork.go and ends up being the parent process, or supervisor of the actual binary being run in the container /proc/self/exe) actually waits on the container process. It is in fact the parent process, the one that sets things up (gun.go for me) where you can start and essentially terminate, but obviously not without setting up the mentioned SysProgAttr(s) above so the process has its own process group and session.

Finally I think its also important not to attach the terminal's standard fds to any part of the process either.

from vessel.

0xc0d avatar 0xc0d commented on May 27, 2024 1

Hi @prologic,

Thank you for your question. I just realized that my implementation was not alright.
For detaching you need to release the underneath process from the parent.

from vessel.

prologic avatar prologic commented on May 27, 2024

Hi @prologic,

Thank you for your question. I just realized that my implementation was not alright. For detaching you need to release the underneath process from the parent.

Yup 😅 Some of my code was/is inspired by your project and I realized this too, hence why I asked. Unfortunately it doens't seem to be as easy as "separate the process from the parent" 😅

from vessel.

prologic avatar prologic commented on May 27, 2024

Screen Shot 2022-09-19 at 01 44 20

from vessel.

Related Issues (1)

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.