I'm trying to use ansible-container to create and deploy my docker application but I can't get it to work.
I have a remote server which I can configure via ansible. On my local machine I'm using ansible-container to build a docker image which is working fine. After running ansible-container build
I have the docker image on my local machine.
However, I don't get the next step to work. My goal is to push the docker image from my local machine to the remote server and then create and start a docker container based on this image on the remote server.
I'm not using a docker registry. Therefore I'm using the --local-images
option for ansible-container deploy
command which prevents it from pushing the image to a registry (at least this is what I understand from the docs). This command successfully creates an ansible playbook but when I execute this playbook it still tries to pull the image from the docker.io registry and of course can't find it there.
I think the missing step is to push the local docker image to the remote server but I can't find any hints in the ansible-container docs for this use-case. I have also looked at ansible docker_image module but as far as I understand this is also centered around using a registry.
How can I deploy a docker image to a remote server with ansible?