If you want to deploy to a remote Docker host from your your local host, there are a couple of options.
You can configure the remote Docker daemon to accept TCP connections, authenticated in both directions using SSL certificates. This is probably the recommended way of setting up remote access, since it is natively supported by the Docker client. You can read more about this in Docker's "Protect the Docker daemon socket" documentation.
A second option is to forward the Docker socket from the remote host to your local host over an ssh tunnel. If you ssh into the remote host like this...
ssh -L /tmp/docker.sock:/var/run/docker.sock me@remotehost
...then you can access the remote Docker daemon using the /tmp/docker.sock socket on your local host. You would need to set your DOCKER_HOST environment variable like this:
export DOCKER_HOST=unix:///tmp/docker.sock
docker-compose recognizes the DOCKER_HOST environment variable as well.
Of course, this only works as long as you are connected to the remote host.
For example:
bash-5.0$ docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
bash-5.0$ ssh -nN -L /tmp/docker.sock:/var/run/docker.sock docker.local &
[1] 1363146
bash-5.0$ export DOCKER_HOST=unix:///tmp/docker.sock
bash-5.0$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
10924fc5f455 registry:2 "/entrypoint.sh /etc…" 2 weeks ago Up 19 hours 0.0.0.0:5000->5000/tcp registry
(Here I've placed my ssh connection in the background so that I can continue to work on my local host. You could of course just using a second terminal for the ssh connection.)
docker-compose.ymland associated files to the remote host, and rundocker-composethere?