Embed Docker executables into Docker container

I did some additional research and found nice post, where almost all possible solutions were mentioned.

Generally there is two options to actually run Docker’s build job on Jenkins:

  1. Embed Docker’s binaries into Jenkins image. It could be just docker-ce-cli package.
  2. Route Docker’s binaries on the host to container VM:
docker run  \
  --name jenkins \
** --volume /var/run/docker.sock:/var/run/docker.sock \**
**  --volume $(which docker):/usr/bin/docker \**
jenkins/jenkins

The first option routes docker.sock to container and the second exposes Docker’s binaries from the host to the container.

Unfortunately, the second option didn’t worked for me under any circumstances: I tried to run container in the privilege mode, under the root user, added Jenkins user to root group (for home PC it’s okay), chmod 777 /var/run/docker.sock, usermod -aG docker jenkins. No way.
The last thing I gave a shot:

docker run -u root \
  --privileged \
  --name jenkins \
  --detach \
  --network jenkins \
  --publish 9000:8080 \
  --publish 60000:50000 \
  --volume jenkins-data:/var/jenkins_home \
  --volume /var/run/docker.sock:/var/run/docker.sock \
  --volume $(which docker):/usr/bin/docker \
jenkins/jenkins

So finally I decided to give up and just embed Docker’s executables (docker-ce-cli) into my Jenkins image with --volume /var/run/docker.sock:/var/run/docker.sock \ option, which successfully exposes all of my host-machine’s images to the Jenkins’s container.
Guess, it’s more MacOS-related issues, because I red thousands messages of Linux users, which has confirmed that routing of binaries (the 1-st way) works good for them.