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

1 Answer: 

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

More Articles

shell - monitor for file then copy to another directory

I'm relatively new to unix scripting, so apologies for the newbie question.I need to create a script which will permanently run in the background, and monitor for a file to arrive in an FTP landing directory, then copy it to a different directory, and lastly remove the file from the original directo

Why does the following code raise a SegFault. c(Linux)

This a code that would reverse the data of a document and save it in the same document itself.However I am getting a Segmentation Fault.Please Help,I don't know why it gives a SegFault.#include <stdio.h>#include <stdlib.h>#include <termios.h>#include <fcntl.h>#include <str

mysql - Apache2 / phpmyadmin - PHP isn't working

I was working on a project of mine . then i had to restart the computer.Once I did suddenly PHP stopped working on Apache. then i starting looking into the configuration files and error logs and fixed a spelling error in the config file, but STILL the problem persisted, then i decided to re-install

Shell script - convert Excel (xlsx) to CSV - remove blank space / tab space

I receive excel file (xslx) with multiple sheets for my project. The number of records on these sheets ranges from 15k to 70k per sheet. I need to perform following tasks on this data and then convert it to CSV. Or covert to CSV and then process the data either way its fine.Input Example:call_no un

node.js - Querying multiple sensors regularly using NodeJS

I need to fetch the values of about 200 sensors every 15 seconds or so. To fetch the values I simply need to make an HTTP call with basic authentication and parse the response. The catch is that these sensors might be on slow connection so I need to wait at least 5 seconds for one sensor (but usuall

Segmentation fault: Stack allocation in a C program in Ubuntu when bufffer>4M

Here's a small program to a college's task:#include <unistd.h>#ifndef BUFFERSIZE#define BUFFERSIZE 1#endifmain(){ char buffer[BUFFERSIZE]; int i; int j = BUFFERSIZE; i = read(0, buffer, BUFFERSIZE); while (i>0) { write(1, buffer, i); i = read(0, buffer, BUFFE

php - Having trouble with Ubuntu LAMP stack

I have installed Ubuntu 16.04 LTS, Apache2, Mysql 14, Php7. I have installed Drupal with a few difficulties. Specifically, I had to install php extensions and tweak the configs to enable those extensions, and finally the installation was successful. However, whenever I try to click on any link, the

Segmentation Fault Core dump with C on ubuntu

I have a problem with some line of codes I've written in plain C.It worked fine on windows, but on ubuntu there's an error saying "Segmentation Fault (core dumped)". I've searched for answers but there's too many problem that can caused that error.char line[80];char sett[50][80];int index=0;static c

linux - Docker run command error

I have just installed docker and pulled their official ubuntu image following their documentation installation tutorial.However, when I get to the point of executing a command in a specific container, I end up with the following error:Error: Cannot start container f6e1084236794548bbd5cd059f46f916367

c - Encountering segment fault when printing out directories in Ubuntu

I've been working on this code for a while and I can not figure out the problem. The idea is to print out all directories and sub directories from the given directory (hard coded for testing purposes). However, I keep getting a segmentation fault.#include <stdio.h>#include <dirent.h>#in