Skip to content

support rootless mode? #1287

Closed
Closed

Description

@edwintorok

One of the install steps here shows how to use 'sudo' to install it: https://docs.dagger.io/1001/install/
That shouldn't be needed, lately I use containers that run in rootless mode (e.g. podman instead of docker and a wrapper that calls podman instead of docker for backwards compat, or runc, etc.), and a rootful docker may simply not be available in certain environments as a matter of security policy.

Therefore it'd be very useful if the sudo installation mode would be optional and dagger could run fully featured in rootless mode.
i.e. it'd be very nice if dagger was rootless first (sort of how you develop your applications cloud first, etc.)
I haven't tried yet whether this'd be possible by using the 'install from source' method, but the documentation doesn't mention rootless at all.

See https://rootlesscontaine.rs/ for various ways of running rootless containers (docker can do it too, although none of the distros I use have actually packaged the rootless mode of docker).

There is also some information here on how to use BuildKit with podman that might prove useful in integrating into dagger's docs: https://pythonspeed.com/articles/podman-buildkit/

Activity

  1. edwintorok commented on Dec 22, 2021

    @edwintorok
    Author

    I've experimented a bit on Fedora 35, install podman and the backwards compatible docker wrapper, then start the socket in rootless mode:

    $ sudo dnf install podman podman-docker
    $ sudo touch /etc/containers/nodocker
    
    $ systemctl start --user podman.socket
    $ systemctl status --user podman.socket
    
    ● podman.socket - Podman API Socket
         Loaded: loaded (/usr/lib/systemd/user/podman.socket; disabled; vendor preset: disabled)
         Active: active (listening) since Wed 2021-12-22 11:34:46 GMT; 18min ago
       Triggers: ● podman.service
           Docs: man:podman-system-service(1)
         Listen: /run/user/1000/podman/podman.sock (Stream)
         CGroup: /user.slice/user-1000.slice/[email protected]/app.slice/podman.socket
    
    Dec 22 11:34:46 fedora systemd[10111]: Listening on Podman API Socket.
    

    Then start buildkit (dagger can't figure out how to do this on its own), it just says the container doesn't exist:

    podman run -d --name buildkitd --privileged docker.io/moby/buildkit:latest
    export BUILDKIT_HOST=docker-container://buildkitd
    

    Then in the todoapp example set the docker socket like this:

    dagger -e local --log-level=debug input socket dockerSocket /run/user/1000/podman/podman.sock
    

    Then try to bring it up:

    dagger up --log-level=debug
    

    This gets me as far as this:

    12:01PM FTL failed to up environment: task failed: process "/bin/bash -c # (f: str -> int)\nnb_retries=$(($NB_RETRIES+0))\nstarting_period=$(($START_PERIOD+0))\n\nstatus=\"0\"\nSECONDS=0\n# START_PERIOD implementation\nwhile [ $SECONDS -lt $starting_period ]; do\n\tstatus=\"$(curl --connect-timeout 1 -s -o /dev/null -w ''%{http_code}'' $HEALTH_URL)\"\n\tif [ \"$status\" == \"200\" ]; then\n\t\texit 0;\n\tfi\n\tsleep 1;\ndone\n\n# TIMEOUT, INTERVAL, INTERVAL implementation\nfor ((i=0;i<NB_RETRIES;i++)); do\n\tstatus=\"$(curl --connect-timeout $TIMEOUT -s -o /dev/null -w ''%{http_code}'' $HEALTH_URL)\"\n\tif [ \"$status\" == \"200\" ]; then\n\t\texit 0;\n\tfi\n\tsleep \"$INTERVAL\";\ndone\n\nexit 1;" did not complete successfully: exit code: 1
    
  2. edwintorok commented on Dec 22, 2021

    @edwintorok
    Author

    Got a little further by running buildkitd like this instead:

    docker rm -f buildkitd
    podman run -d --name buildkitd --privileged --network=host docker.io/moby/buildkit:latest
    

    Then the failure is:

    executing operation    do=exec pipeline=run.run                                                                                       
                                                                                                                                                      
    #1 load metadata for docker.io/library/alpine:3.13.5@sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f           locally    
    #1 sha256:703a8efa84578e0eeea62f1e909b202dbdba4a14cbb81bc8ae20e916388aaa88                                                                        
    #1 DONE 0.0s                                                                                                                          ef72b3107d7…
                                                                                                                                                      
    #26 Exec ["/bin/bash", "--noprofile", "--norc", "-eo", "pipefail", "/setup.sh"]                                                       
    #26 sha256:4b83c7c78ebf4d1d5f611e5913ada1afd9b51e09bf1486b7d2ac6cd30ab02693                                                           
    #26 0.155 Error: No such object: todoapp                                                                                                          
    #26 0.179 Unable to find image 'localhost:5042/todoapp:latest@sha256:8f8b2b2a6f84e5dca1107af651055ac4013cf218dd5ef72b3107d7061acbc66e' locally    
    #26 0.185                                                                                                                                         
    #26 0.185 docker: Error response from daemon: No such image: localhost:5042/todoapp@sha256:8f8b2b2a6f84e5dca1107af651055ac4013cf218dd5ef72b3107d7…
    #26 0.185 See 'docker run --help'.                                                                                                                
    #26 ERROR: process "/bin/bash --noprofile --norc -eo pipefail /setup.sh" did not complete successfully: exit code: 125                
    ------                                                                                                                                
    > @run.run@ Exec ["/bin/bash", "--noprofile", "--norc", "-eo", "pipefail", "/setup.sh"]:                                              
    ------                                                                                                                                
    12:21PM FTL failed to up environment: task failed: process "/bin/bash --noprofile --norc -eo pipefail /setup.sh" did not complete successfully: exit code: 125
    
  3. edwintorok commented on Dec 22, 2021

    @edwintorok
    Author

    Creating this file solves the last error:

    ~/.config/containers/registries.conf
    [registries.insecure]
    registries = ['localhost:5042']
    

    (maybe there is a way to do this via the API / CLI, but not sure, it doesn't really like localhost:5042 as an insecure registry otherwise, it would try to contact it over HTTPS not HTTP).

  4. aluzzardi commented on Jan 7, 2022

    @aluzzardi
    Contributor
  5. rubin55 commented on Jun 28, 2022

    @rubin55

    I'm curious if there has been any movement on this? Looking to use dagger but the GitLab CI/CD environment we are using is not under our control and they have a restriction on the usage of privileged containers (i.e., we can't run dind, so we use kaniko for our image building needs). I would suppose that dagger supporting unprivileged/rootless mode means we could use it with our restricted GitLab CI/CD environment.

  6. kajogo777 commented on Sep 20, 2022

    @kajogo777

    I am trying to run dagger inside a Kubernetes pod.

    just to make sure I understand, it is not currently possible to run dagger without dind and access to docker sock?

  7. gerhard commented on Sep 22, 2022

    @gerhard
    Contributor

    it is not currently possible to run dagger without dind and access to docker sock?

    Dagger v0.2 dependency is BuildKit. By default, it uses Docker to provision it, but this can be customised: https://docs.dagger.io/1223/custom-buildkit/#using-a-custom-buildkit-daemon

    If you need to use Docker functionality, e.g. https://github.com/dagger/dagger/tree/main/pkg/universe.dagger.io/docker, then you will need access to Docker. Docker can run remotely, outside of K8s.

  8. rubin55 commented on Sep 22, 2022

    @rubin55

    @gerhard could you elaborate a bit? We're in the process of evaluating Dagger and Earthly and we're in a large-scale enterprise environment that won't allow privileged containers. Can you be more explicit, i.e, is DinD a hard requirement and so you really need to have a separate, dedicated env for it so as to alleviate/work-around the privileged container issue?

    Essentially, at least in our case, we have a gitlab environment with gitlab-runner on a dedicated docker 3-node cluster (using portainer) where we have no privileged container option, which targets a kubernetes environment where we also can't run privileged containers. Does that mean using dagger (or earthly for that matter, as they also depend on BuildKit) is impossible in this scenario (and you would need to create a dedicated privileged containers-enabled environment)?

  9. added
    area/engine
    on Dec 8, 2022
  10. mircubed commented on Dec 8, 2022

    @mircubed
    Contributor
  11. rubin55 commented on Dec 9, 2022

    @rubin55

    @mircubed how do you access that discord link? When I click it, my discord client shows an empty page saying "No text channels".

  12. joshuaswickirl commented on Dec 9, 2022

    @joshuaswickirl

    @mircubed how do you access that discord link? When I click it, my discord client shows an empty page saying "No text channels".

    You have to join the discord server first. https://discord.gg/dagger-io

  13. pmengelbert commented on Feb 9, 2023

    @pmengelbert

    I'm using the rootless setup provided by docker, it hangs indefinitely on importing/exporting files from the containers

  14. 1 remaining item

  15. TomChv commented on Aug 10, 2023

    @TomChv
    Member

    @dispensable You should have a look at this part of our doc, you might be able to use rootless with a custom OCI runtime like nerdctl

  16. added a commit that references this issue on Sep 21, 2023
    748e4fb
  17. added 5 commits that reference this issue on Nov 24, 2023
    883f2e8
    ea66183
    50063d8
    3c7b16f
    86e2b6f
  18. added a commit that references this issue on Jan 27, 2024
    e63200d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/enginekind/user-request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions