LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-28-2019, 03:27 AM   #1
undefineduser
LQ Newbie
 
Registered: Nov 2019
Distribution: Arch
Posts: 9

Rep: Reputation: Disabled
Command not recognized via SSH but with docker exec


Hello,

i'm working with the golang:stretch (Debian Stretch with GO) docker container and wanted to connect directly on the docker container via SSH as root, which worked.
But the go command was not recognized.

When I connect to the container via
" docker exec -ti golang-container bash ", I am also logged in as root and it recognizes the go command. But if I log on to the container with another user, and then as root, he doesn't recognize the go command either.

Could someone tell me why?
 
Old 11-28-2019, 07:23 AM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Can you provide the commands that fail to run Go?

My guess is that ssh enters a different environment than docker exec, with a different PATH. In the docker exec shell, run type go to check where go is located.
 
Old 11-28-2019, 08:41 AM   #3
undefineduser
LQ Newbie
 
Registered: Nov 2019
Distribution: Arch
Posts: 9

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by berndbausch View Post
Can you provide the commands that fail to run Go?

My guess is that ssh enters a different environment than docker exec, with a different PATH. In the docker exec shell, run type go to check where go is located.
Its just go, for example go run application.go

When Im logged in via docker exec, which go prints a path (/usr/local/go/bin/go), via SSH nothing.
 
Old 11-28-2019, 09:18 AM   #4
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by undefineduser View Post
Its just go, for example go run application.go

When Im logged in via docker exec, which go prints a path (/usr/local/go/bin/go), via SSH nothing.
Add /usr/local/go/bin to your PATH. Off-hand, I can't explain why the docker exec shell environment includes the correct PATH, but the ssh environment doesn't.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Ubuntu LXD: Not a Docker replacement, a Docker enhancement LXer Syndicated Linux News 0 11-05-2014 08:40 PM
[SOLVED] raspbian: how to log in via ssh through wlan? (dont work; but ssh via LAN works) floppy_stuttgart Debian 8 03-24-2014 01:42 PM
Xbox 360 Controller not recognized by Ubuntu but recognized by programs? HolyMythos Linux - Newbie 1 06-19-2012 07:28 AM
exec cmd=perl... work but exec cgi doenst crions Slackware 5 12-09-2005 12:17 PM
eth0 recognized but not recognized? rafc Linux - Newbie 7 04-21-2004 04:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration