Emma
Emma

Reputation: 31

How to get my docker terminal to complete a command?

I'm sorry to post a question like this, but I have no idea what to do. I have been trying to run RStudio on Docker for the past two days and I cannot get my terminal to work with me. I run the command

docker run --rm -p 8787:8787 -e PASSWORD=passsword rocker/rstudio

and it runs without any error messages, but it ends without ever returning the shell command, and it seems incomplete.

Last login: Mon Jun 29 11:51:51 on ttys001
Emmas-MacBook-Air-2:~ shell$ docker run --rm -p 8787:8787 -e PASSWORD=password rocker/rstudio
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] userconf: executing... 
[cont-init.d] userconf: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.

And that's it--the terminal won't let me run any other commands without restarting it, and I can't get to dockerized RStudio (idk if that's the right way to say it). Could there be something wrong with my terminal or command that is preventing it from installing RStudio fully??

Thank you

Upvotes: 0

Views: 697

Answers (1)

Palash Goel
Palash Goel

Reputation: 664

docker run --rm -p 8787:8787 -e PASSWORD=passsword rocker/rstudio

When you run this command, your docker container runs in the foreground. Your container is completely in only alive till this command is running. Thus, this terminal does not return the shell prompt to you.

After running this command, create a new terminal tab and run this command to get a shell prompt into docker container: docker exec -it <container-id> sh


However, I would recommend you run it in this way:

  1. Run docker run -d --name=rstudio --rm -p 8787:8787 -e PASSWORD=passsword rocker/rstudio

-d will tell docker to run this container in background(daemon) mode.

--name will help us in identifying this container later

  1. Check if the container is running using docker ps
  2. Use docker exec -it rstudio sh to get a terminal into rstudio machine

Upvotes: 2

Related Questions