<p>When creating a cluster with Rancher I note that Docker appears to be installing on the nodes(through rancher server ui). The problem is I am using an AMI with docker already installed with a docker image that I would like to use on the cluster after provisioning. This re-installation of docker appears to remove this docker image after provisioning.</p>

magladde
<p>If you're using rancher to bring k8s cluster on AWS using amazon EC2 option.</p>

<p>Then it will provision new EC2 in your aws account and will configure everything on it (like installing docker, k8s and so on).</p>

<p>To avoid this and to use your own ami which has pre-pulled docker image, you need to use <a href="https://rancher.com/docs/rancher/v2.x/en/cluster-provisioning/rke-clusters/custom-nodes/" rel="nofollow noreferrer">custom k8s</a> option of rancher. </p>

<p>In which you bring AWS EC2 machines with your own ami and then in rancher by selecting custom nodes k8s option you will have to just run a docker run command provided by rancher to configure that EC2 as either etcd, master or worker node of k8s cluster.</p>

<p>More info <a href="https://rancher.com/docs/rancher/v2.x/en/cluster-provisioning/rke-clusters/custom-nodes/" rel="nofollow noreferrer">here</a>.</p>

<p><strong>Update:</strong></p>

<p>To automate creation of aws ec2's make use of tools like <a href="https://www.terraform.io/" rel="nofollow noreferrer">terraform</a>.</p>

<p>Here is the getting started <a href="https://learn.hashicorp.com/terraform/getting-started/install.html" rel="nofollow noreferrer">guide</a>, also few aws terraform examples <a href="https://github.com/terraform-providers/terraform-provider-aws/tree/master/examples" rel="nofollow noreferrer">here</a>.</p>
