Code Monkey home page Code Monkey logo

Comments (17)

Defozo avatar Defozo commented on May 31, 2024 1

I think the problem was due to some invisible extra characters.
I especially recommend ababkov's comment here for anybody googling this problem.

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...

Thank you for your help! :)

from baseimage-docker.

FooBarWidget avatar FooBarWidget commented on May 31, 2024

Yes this is a bug. See GH-45. Already fixed in git master, will release soon.

from baseimage-docker.

moonbingbing avatar moonbingbing commented on May 31, 2024

this bug still exist in version 0.9.16. what's wrong?

from baseimage-docker.

OnixGH avatar OnixGH commented on May 31, 2024

@moonbingbing what problem are you seeing? The image seems to work fine for me:

# docker run -i -t onix/test:0.9.16 /sbin/my_init -- bash
*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
*** Running /etc/my_init.d/logtime.sh...
*** Running /etc/rc.local...
*** Booting runit daemon...
*** Runit started as PID 14
*** Running bash...
root@54e9871459ed:/#

On a sidenote, the bug from GH-45 is definitely fixed, but I'm not sure it was related because the pre-fix image also works without problems with the logtime example.

from baseimage-docker.

moonbingbing avatar moonbingbing commented on May 31, 2024

@OnixGH thanks for reply.
my docker file is

FROM phusion/baseimage:0.9.16

RUN mkdir -p /etc/my_init.d
ADD test.sh /etc/my_init.d/test.sh

# Use baseimage-docker's init system.
CMD ["/sbin/my_init"]

test.sh content is

#In logtime.sh (make sure this file is chmod +x):
#!/bin/bash
/bin/date > /tmp/boottime.txt

the result is

sudo docker run -i -t ming/test /sbin/my_init -- bash
*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
*** Running /etc/my_init.d/test.sh...
*** /etc/my_init.d/test.sh failed with status 127

*** Killing all processes...

from baseimage-docker.

OnixGH avatar OnixGH commented on May 31, 2024

@moonbingbing try removing the first comment line of test.sh, so that it starts with #!/bin/bash. That works for me.

from baseimage-docker.

OnixGH avatar OnixGH commented on May 31, 2024

I've updated the documentation to help avoid this mistake.

from baseimage-docker.

kunthar avatar kunthar commented on May 31, 2024

👌
thx.

from baseimage-docker.

Defozo avatar Defozo commented on May 31, 2024

I'm having the same problem despite having #!/bin/bash at the beginning of the file.

from baseimage-docker.

Theaxiom avatar Theaxiom commented on May 31, 2024

@Defozo Could you please paste your script content into a Gist and share it here?

from baseimage-docker.

Defozo avatar Defozo commented on May 31, 2024

I have no fancy code here. Just the one from the example:
Dockerfile:

FROM phusion/baseimage:0.9.19

RUN mkdir -p /etc/my_init.d
COPY logtime.sh /etc/my_init.d/logtime.sh
RUN chmod +x /etc/my_init.d/logtime.sh

CMD ["/sbin/my_init"]

RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

logtime.sh:

#!/bin/sh
date > /tmp/boottime.txt

Console:

$ docker run fd7090916418
time="2017-04-09T15:44:50+02:00" level=info msg="Unable to use system certificate pool: crypto/x509: system root pool is not available on Windows"
*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
*** Running /etc/my_init.d/logtime.sh...
*** /etc/my_init.d/logtime.sh failed with status 127

*** Killing all processes...

from baseimage-docker.

Theaxiom avatar Theaxiom commented on May 31, 2024

Did you try it in Linux? It appears you are running in Windows. I would like to see if the issue persists in Linux.

Try installing Virtualbox and then Vagrant, then type the following commands inside a new, empty folder:

  • vagrant init travisrowland/centos7
  • vagrant up

Add your Dockerfile and logtime.sh files to that folder, then type these commands:

  • vagrant ssh
  • cd /vagrant
  • docker build .
  • docker run

Please let me know how that works out, thanks!

from baseimage-docker.

Defozo avatar Defozo commented on May 31, 2024

I tried it on my Amazon Linux and It's working. Thank you very much.

from baseimage-docker.

Defozo avatar Defozo commented on May 31, 2024

After a few successful tries the problem reappeared on Amazon Linux.
I tried deleting all images and rebuilding - without any success.

I created a new instance and it's working there but I presume it won't work for long.

from baseimage-docker.

Theaxiom avatar Theaxiom commented on May 31, 2024

Can we do a Hangouts session to try and figure out what's going on?

from baseimage-docker.

hyperknot avatar hyperknot commented on May 31, 2024

from baseimage-docker.

Theaxiom avatar Theaxiom commented on May 31, 2024

Thanks for letting us know! 👍

from baseimage-docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.