Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

Docker Client for Buildmaster



  • So I am sure this is pretty easy, but I am new to Proget, Buildmaster and Otter. I have a Proget/Buildmaster server setup by using the official docker images. I am trying to build a docker container that the source is hosted in a AzureDev Ops Git repo. My Buildmaster server will clone the repo fine. When it tries to build it says

    Using LocalAgent agent on localhost
    A Docker client was not detected on this server.
    

    Here is my build script

    # Get Source
    # Fetch code changes from your source control system in order to build and run tests against them.
    {
        Git::Checkout-Code();
    }
    
    # Compile Project
    # Run a familiar build tool such as MSBuild, Maven, make, etc., pull packages & libraries, lint your code, and/or set version numbers.
    {
        Docker::Build-Image();
    }
    
    # Run Tests
    # Execute unit tests, static analysis tools, or capture reports.
    {
    }
    
    # Capture Artifact
    # Create a build artifact from the build output once all tests pass.
    {
        Docker::Tag
        (
            NewTag: latest
        );
    }
    
    

    How do I set up the docker client in the server? Pointing me to the right spot in the documentation would be appreciated, because I can't seem to find where it is.



  • So I fixed it by building a docker image based on the inedo image. Here is my docker file. So far seems to be working well. I then mount a docker socket into the container and then I can set the config variable to the docker executable, /usr/bin/docker.

    FROM debian:bookworm AS build
    
    
    RUN apt-get update
    RUN apt-get install -y ca-certificates curl
    RUN install -m 0755 -d /etc/apt/keyrings
    RUN curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
    RUN chmod a+r /etc/apt/keyrings/docker.asc
    
    # Add the repository to Apt sources:
    RUN echo \
     "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
      $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
      tee /etc/apt/sources.list.d/docker.list > /dev/null
    RUN apt-get update && mkdir /pkgs && apt-get install -y -d -o=dir::cache=/pkgs docker-ce-cli
    
    FROM proget.inedo.com/productimages/inedo/buildmaster:24
    
    COPY --from=build /pkgs/* /tmp
    RUN dpkg -i /tmp/*.deb
    

  • inedo-engineer

    Hi @rpangrazio_2287 ,

    Thanks for sharing that solution; the general approach we arrived at was setting up an SSL Agent to connect to the BuildMaster's Docker host (Installing & Integrating with Docker Engine).

    The approach you took is interesting; are you essentially installing Docker within the container? I assume that uses the Docker engine of the host, not like "docker in docker"?

    Thanks,
    Alana



  • It just installs the command line client, but yeah I am currently using the hosts docker server. I am investing other more secure options. I’ve seen docked in docker setups and may go that route and setup a build worker.


  • inedo-engineer

    Thanks for clarifying that @rpangrazio_2287 , we'll explore that route as well.

    We opted against DinD because of resource management (build servers can be rather resource-intensive) and general instability (not everything seems to work the same).

    FYI - in case you haven't seen it already, BuildMaster does support Image-based Services (Containerized Builds)

    Cheers,
    Alana



  • I am also against DinD because the way I saw it done involved installing a specialized runtime and I'm not particularly crazy about doing that. I'd like to find a more portable way of doing it.

    I admit I am new to Proget/BuildMaster/Otter and really like it so far. So I am sure that I will engineer some solutions that are, to be frank, Rube Goldburg-esque.


Log in to reply
 

Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation