baseimage-docker: Can't start additional daemons

When I try to add custom daemons to my image, I get the following error:

runsv mysql: fatal: unable to start ./run: file does not exist
runsv apache: fatal: unable to start ./run: file does not exist

My Dockerfile:

RUN mkdir -p /etc/service/apache
ADD ./bin/apache.sh /etc/service/apache/run

RUN mkdir -p /etc/service/mysql
ADD ./bin/mysql.sh /etc/service/mysql/run

RUN chmod +x /etc/service/apache/run
RUN chmod +x /etc/service/mysql/run

RUN chown root:root /etc/service/apache/run
RUN chown root:root /etc/service/mysql/run

/bin/mysql.sh:

#!/bin/sh
exec /sbin/setuser www-data /usr/bin/mysqld_safe >>/var/log/mysql_exec.log 2>&1

Any ideas?

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Reactions: 1
  • Comments: 16 (2 by maintainers)

Commits related to this issue

Most upvoted comments

FYI - this was coming back with “./run: file does not exist” for me for any services i attempted to add. When the script was run directly on the box, the following additional info was presented: “Invalid interpreter /#!/bin/sh^M” (or similar).

Issue ended up being dos vs unix line endings. Running the init files through from dos2unix / http://www.virtualhelp.me/linux/164-dos2unix-missing-ubuntu-1004 resolved the issue for me after 4 hours of head banging…

thanks mvdpoel, kinda sorted out “my” issue…

there had to be some sort of nasty character around the lines so I just cleaned up the file and now it looks alright and working… CTRL+V is BAAAAD

😉

I have similar issue and problem was in one extra space character on first line. Instead of:

#!/bin/bash
...my script

I have:

 #!/bin/bash
^
|
+--- here! do you see it?