I want to have docker CLI to connect to remote daemon but do I need to install the whole engine including daemon on the local machine?
First, download and unzip/untar the release for your system. Here are x86_64 binaries for mac, linux, windows.
After expanding the archive, you can find the docker CLI executable at ./docker/docker - move that file into your path, and you're done.
If you're specifically looking to install the docker CLI into a docker image, here's my Dockerfile command to do so:
ENV DOCKERVERSION=18.03.1-ce
RUN curl -fsSLO https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKERVERSION}.tgz \
&& tar xzvf docker-${DOCKERVERSION}.tgz --strip 1 \
-C /usr/local/bin docker/docker \
&& rm docker-${DOCKERVERSION}.tgz
h/t to this comment