bash - Dockerfile CMD not running at container start -
so i've written dockerfile project, i've defined cmd run on starting container bootstrap application.
the dockerfile looks like
# create our mount folders , volumes env mounted_volume_dir=sites run mkdir /$mounted_volume_dir env path=$mounted_volume_dir/sbin:$mounted_volume_dir/common/bin:$path run chown -rf www-data:www-data /$mounted_volume_dir # mount folders volume ["/$mounted_volume_dir/"] # expose ports expose 443 # add our environment variables server add ./env /env # add entry point script add ./start.sh /usr/bin/startcontainer run chmod 755 /usr/bin/startcontainer # define entrypoint command cmd ["/bin/bash", "/usr/bin/startcontainer"]
the start.sh script, git stuff cloning right repo, setting environment vars, starting supervisor.
the start script begins this
#!/bin/bash now=$(date +"%t") echo "container start time : $now" >> /tmp/start.txt /usr/bin/supervisord -n -c /etc/supervisord.conf
i start new container this
docker run -d -p expoport:contport -t -i -v /$mounted_volume_dir/$project:/$mounted_volume_dir $container_id /bin/bash
when login container see supervisor hasn't been started, , neither has nginx or php5-fpm. /tmp/start.txt file timestamp set startcontainer script doesn't exist, showing never ran cmd in dockerfile.
any hints on fixed great
this:
docker run -d -p expoport:contport -t -i -v /$mounted_volume_dir/$project:/$mounted_volume_dir $container_id /bin/bash
says 'run /bin/bash' after instantiating container. e.g. skip cmd
.
try this:
docker run -d -p expoport:contport -t -i -v /$mounted_volume_dir/$project:/$mounted_volume_dir $container_id
Comments
Post a Comment