Restart Docker from command line

Note: It may take up to a minute for Docker to fully start

I used the following snippet to deal with the issue of knowing when docker is ready to take commands:

while ! docker system info > /dev/null 2>&1; do sleep 1; done

So e.g.:

open --background -a Docker &&
  while ! docker system info > /dev/null 2>&1; do sleep 1; done &&
  docker run busybox
4 Likes