Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker: bash terminal starts without prompt

I have a simple container that looks like this:

FROM devbox/rails3.2.1

RUN apt-get install -y -q libmysql-ruby libmysqlclient-dev
RUN apt-get install -y -q libqtwebkit-dev
EXPOSE 3000
CMD /bin/bash

where devbox/rails3.2.1 is a container I made that starts with 'FROM ubuntu' and installs Ruby on Rails. This is a running in a Vagrant Virtual Box VM using Ubuntu 12.04.3 LTS. When I run this using:

 docker run -t -i -name myapp -p 3000:3000 -v /src/myapp:/src/myapp -link myappsql:myappsql devbox/myapp

The container starts, but my terminal shows a blank line with no prompt and typing doesn't do anything. If I run docker ps I can see that the container is running. Even stranger, If I open a second terminal and run 'docker attach myapp' I get a functioning terminal (though I have to press enter first) and if I switch back to my first terminal and type, the output appears in my second terminal!

Any help much appreciated.

like image 553
Brad Urani Avatar asked Oct 21 '22 17:10

Brad Urani


1 Answers

That all sounds like expected functionality. When doing the "docker run" command put the "/bin/bash" in it to immediately have the bash available to you without having to attach first.

docker run -t -i -name myapp -p 3000:3000 -v /src/myapp:/src/myapp -link myappsql:myappsql devbox/myapp /bin/bash
like image 183
jchysk Avatar answered Oct 23 '22 07:10

jchysk