title: How do I use insecure docker registries with Amazon EC2 Container Service (ECS)?
body: <p>We use a Docker registry inside our AWS VPC that is not accessible externally. We want to be able to launch tasks in ECS from this registry, however we see that the service is only ever at a PENDING state because the Docker daemon isn't able to access the registry.</p>
  
  <p>I have found a sort of workaround by changing the launch configuration's user data but it doesn't feel like I'm doing this the best way:</p>
  
  <pre><code>#!/bin/bash
  echo ECS_CLUSTER=MY_CLUSTER_NAME &gt;&gt; /etc/ecs/ecs.config
  echo OPTIONS=--insecure-registry=insecure.registry.hostname:5000 &gt; /etc/sysconfig/docker
  service docker restart
  docker start ecs-agent
  </code></pre>
  
  <p>This works perfectly, and I can see my task is running as expected. I just don't think this is necessarily the best way to do it.</p>
  
  <p>AWS pointed me towards <a href="https://aws.amazon.com/blogs/aws/ec2-container-service-ecs-update-access-private-docker-repos-mount-volumes-in-containers/" rel="nofollow">this</a> article which discusses authenticating with private registries, but I'm not looking to authenticate, just to have Docker ignore the fact that I'm using an insecure (ie not HTTPS) registry.</p>
  
  <p>Does anyone have a better solution?</p>
  
  <p>Thanks</p>