I can't SSH into my docker container using launcher

(Ben M) #1

This used to work fine but I haven’t tried to SSH in for some weeks.

I have tried rebuilding my container using

sudo ./launcher rebuild app

but this still prompts me for a root password

sudo ./launcher ssh app
root@'s password:

I’m using the latest discourse_docker from https://github.com/discourse/discourse_docker.git.

I have a feeling that the authorized_keys file in the app container isn’t being refreshed when I run that rebuild command above. (Also, when I run that rebuild should it clean out my database or not?)


Explanation of the prompt: It first tries to use a private key to log in and after failing it tries to ask for a password; but as you never have defined one that’s not doable.

The installation instructions assume you are always on the user root. You can’t install Discourse on root (putting the private key into /root ) and then ssh into it through sudo.

I also hit this issue as someone may want to disable root on his server. I guess you can copy the privatekeys etc to ~ and then it should let you in.

(Ben M) #3

Ah ok. When you say

do you mean copy them to the root user’s home/.ssh directory (which would allow launcher ssh to log in as root)?


Meant to say: from the ssh folders in /root to ~, eh, sorry :stuck_out_tongue:

(Jeff Atwood) #5

Have you tried the launcher enter command instead?

It is possible to skip the ssh key generation step for the root user during the install, but if you did that you would never have been able to ssh in…

(Ben M) #6

@codinghorror Good idea. Yes, I can get in using enter so that seems to serve my purpose for now.

Bugs me that I can’t get SSH to work though… :frowning: Is there a supported way to configure which user the discourse_docker creates the docker container as? I think it’s hard-coded to root right? My problem is that I’m running docker on a VM (Ubuntu 14) where I don’t have access to the root user, but I do have another superuser I can use.

@Moter8 I don’t have a home folder for the root user. I’m logged in as another (super) user, which I think is an unsupported setup?

(Nilesh Trivedi) #7

I am facing this too. And worse, I cannot run “bundle exec rails console” using “./launcher enter app” either.

(Kane York) #8

Are you missing this section from app.yml?

## Remember, this is YAML syntax - you can only have one block with a name
  - exec: echo "Beginning of custom commands"

  #- exec: echo "SiteSetting.login_required=false" | rails c

  ## If you want to authorized additional users, uncomment and change:
  #- exec: ssh-import-id username
  #- exec: ssh-import-id anotherusername

  - exec: echo "End of custom commands"
  - exec: awk -F\# '{print $1;}' ~/.ssh/authorized_keys | awk 'BEGIN { print "Authorized SSH keys for this container:"; } NF>=2 {print $NF;}'

(Ben M) #9

I have that all in my app.yml.