Create registry data folder: file.directory: - name: /srv/registry - user: root - group: root - mode: "0755" Create registry-container systemd unit file: file.managed: - name: /etc/systemd/system/registry-container.service - source: salt://docker/files/registry-container.service - user: root - group: root - mode: "0644" Realod systemd daemon: cmd.run: - name: systemctl daemon-reload - onchanges: - file: Create registry-container systemd unit file Pull docker-registry image: cmd.run: - name: "podman image pull {{ pillar['docker']['url'] }}:{{ pillar['docker']['tag'] }}" - unless: "podman image exists {{ pillar['docker']['url'] }}:{{ pillar['docker']['tag'] }}" Stop docker-registry container before rebuild: service.dead: - name: docker-registry-container - onchanges: - cmd: Pull docker-registry image Remove old docker-registry container: cmd.run: - name: podman container rm docker-registry - onlyif: podman container exists docker-registry - onchanges: - cmd: Pull docker-registry image Create docker-registry container: cmd.run: - name: podman container create --name docker-registry --publish 5000:5000 --volume /srv/registry:/var/lib/registry --env REGISTRY_PROXY_USERNAME={{ pillar['docker']['username'] }} --env REGISTRY_PROXY_PASSWORD={{ pillar['docker']['access_token'] }} --env REGISTRY_PROXY_REMOTEURL=https://registry-1.docker.io {{ pillar['docker']['url'] }}:{{ pillar['docker']['tag'] }} - unless: podman container exists docker-registry Start the docker-registry container: service.running: - name: registry-container - enable: True - watch: - file: Create registry-container systemd unit file