Search code examples
dockerrhelrhel7redhat-containers

Connecting the Docker Daemon insde the CDK on RHEL based docker images


I want to use the docker command line tool as in "docker ps", "docker build" and "docker run". How can I connect "docker" to the Docker Daemon inside the CDK, so I can create RHEL-based Docker images?


Solution

  • Use the vagrant-service-manager plugin to set up your host environment for connecting your client Docker binary (docker) to the Docker service running inside CDK. In the directory with the Vagrantfile you used to launch CDK, run:

    eval "$(vagrant service-manager env docker)"
    

    This will export environment variables that instruct the docker binary to connect to CDK.

    To display info about the services running inside CDK and about the necessary settings to connect to the from your host (i.e. to see what the first command does), run:

    vagrant service-manager env
    

    See documentation for details: Using the vagrant-service-manager Plugin.

    If you don't already have the docker client binary installed on your host system, vagrant-service-manager can do it for you:

    vagrant service-manager install-cli docker
    

    More details in documentation: Preparing Host System for Using Docker from the Command Line.


    Just like using the docker binary to connect to the Docker daemon inside CDK, you can use the oc binary to connect to the OpenShift service running in CDK. Installation and set up is analogous to the docker client.