0

EDIT: I'am using the same user and the deamon is running, I can do all my docker command on the target without any issue.

Trying to use reponsse module without success. I think the issue is comming from PATH what's not be loaded so cannot found docker bin. Tryed with command: /bin/bash "docker image prune --all " but not working Have you any idea ?

- name: docker image prune
  # become: True
  expect:
    command: docker image prune --all 
    responses:
      (?i)continue: "y"

ERROR:

TASK [docker_purge : docker image prune] ********************************************
fatal: [s00xxxxxx]: FAILED! => {"changed": true, "cmd": "docker image prune --all", "delta": "0:00:00.187062", "end": "2020-02-12 11:17:38.911435", "msg": "non-zero return code", "rc": 1, "start": "2020-02-12 11:17:38.724373", "stdout": "WARNING! This will remove all images without at least one container associated to them.\r\nAre you sure you want to continue? [y/N] Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?", "stdout_lines": ["WARNING! This will remove all images without at least one container associated to them.", "Are you sure you want to continue? [y/N] Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?"]}

Thanks

rab
  • 133
  • 2
  • 13
  • Start the docker daemon on the `s00xxxxxx` remote host. It is not running, as suggested by your error message: `Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?` – Zeitounator Feb 12 '20 at 12:48
  • docker is running, with the same user I can run all docker command. – rab Feb 12 '20 at 13:17
  • The error message is saying the exact contrary. You need to find out why you do not agree with your remote server. Warning: get ready to be wrong because the machine is usually right. – Zeitounator Feb 12 '20 at 13:22
  • @Zeitounator my bad, I don't know why but after reboot docker, it's working fine.Thanks guys for help. – rab Feb 12 '20 at 15:08

1 Answers1

1

There could be 2 problems:
1. docker is not running on target machine
2. Permission, with the user you are trying to remove images, don't have permission.

like I can see become is commented so here you can try with become.

anand
  • 741
  • 5
  • 11
  • Hi dear, no the deamon is running I can do all command with the same user directly on the target – rab Feb 12 '20 at 13:18