If you have several instances, we fixed the old platforms with the following script, but you can transfer it to new platforms. Example .ebextensions/01-docker-hostname.config :
files: "/opt/elasticbeanstalk/hooks/appdeploy/pre/04a_set_hostname.sh": mode: "000755" owner: root group: root content: | #!/usr/bin/env bash hostname $(hostname -f | cut -d"." -f1,2) sed -i "s/docker run -d \\\/docker run -d -h $(hostname) \\\/" /opt/elasticbeanstalk/hooks/appdeploy/enact/04run.sh
As you can see, our script always corrects the run of the script. EB runs scripts in order of file names. Therefore, you must be sure that your script is running before the script runs.
source share