docker-archive / for-aws

92 stars 26 forks source link

Binaries installed in Cloud Formation user data dissapear after instance is started #42

Open soanni opened 7 years ago

soanni commented 7 years ago

Hi Docker experts, I need to modify user data in Cloud Formation template. i want to install a couple of binaries for every ec2 started in autoscaling group. i'm modifying user data in launch configuration, adding these lines (escaping everything so that's for sure not the issue here):

apk update
apk add --update python python-dev py-pip build-base gcc libffi-dev openssl-dev
apk --no-cache add nfs-utils

After the instance is started i can't find any of the installed binaries, however in instance log i can see that they were installed. even find command finds nothing in filesystem. They simply dissapear. Thank you.

soanni commented 7 years ago

@kencochrane, i know that you are the AWS expert here. could you please help me? this thing drives me crazy. Thank you in advance

kencochrane commented 7 years ago

@soanni that is because you are installing them on the base OS, but when you ssh into the host, you are not logging into the host, you are logging into a special container, which is separate from the host.

Why are you trying to install those libraries, if I know the reason, I might be able to give you a better work around.

soanni commented 7 years ago

Thank you @kencochrane. I'm creating ansible-playbook the clone of Cloud Formation Docker 4 AWS. My playbook is working,swarm is creating,scaling is working. But when i'm trying to deploy swarm services ansible need to ssh into ec2 and it needs python to run modules. I missed the thing that 22 port is mapped inside container. Yeah now i understand the issue. What can i do to have python installed and other libs installed? Map volume /usr/bin to that ssh container?

friism commented 7 years ago

Using Ansible with Docker for AWS has come up a couple of time before. This post outlines how to run Ansible inside a container, which I think might be more appropriate: https://medium.com/@tech_phil/running-ansible-inside-docker-550d3bb2bdff

Other resources: