i have created images on my local instance want to deploy container from that image here is my playbook code
hosts: all
remote_user: root
become: yes
become_method: sudo
tasks:
- name: Install pip
apt: name=python3-pip state=present
- name: Running the container
docker_container:
name: tmep
image: ipdata:latest
pull: no
- name: Check if container is running
shell: docker ps
when running this playbook it sends me this error
FAILED! => {"changed": false, "msg": "Error pulling image ipdata:latest - 404 Client Error: Not Found (\"b'{\"message\":\"pull access denied for ipdata, repository does not exist or may require \\'docker login\\': denied: requested access to the resource is denied\"}'\")"}
so my questions are
you need a docker registry, just do this:
docker run -d -p 5000:5000 --restart always --name registry registry:2
docker tag ipdata:latest localhost:5000/ipdata:latest
docker push localhost:5000/ipdata:latest
command upon the localhost
is just push your docker image into docker registry on your machine.
assume your machine ipaddress is 10.10.1.12, then run command blow on your server side.
docker pull 10.10.1.12:5000/ipdata:latest
if you are using it without https, maybey you will meet issue blow: Private registry push fail: server gave HTTP response to HTTPS client
just flow solution blow to change your docker client config on your server side. it will be ok. https://github.com/docker/distribution/issues/1874#issuecomment-237194314