sudo: service: command not found

0

Hi,

I'm in the midst of working on the Step 4: Set Up a Client.

I'm able to install Docker and able to view the Docker Version but when comes to "sudo service docker start", it comes out the error --> sudo: service: command not found

The same goes to "go version".

Have tried different method but not working.

Please help, thanks.

質問済み 1年前4014ビュー
1回答
0

The "service" command may not be in the path.
So, try the following settings in "~/.bash_profile".

export PATH=$PATH:/sbin

After putting in the settings, execute the following command to reflect the settings.

source ~/.bash_profile

Or, try the "service" command, specifying the path.

sudo /sbin/service docker start
profile picture
エキスパート
回答済み 1年前
  • Hi, thanks for the above guidance. Yes, I did update the ./bash_profile. Also, after updating it - I did type this --> source ~/.bash_profile as well before the following command below:

    sudo /sbin/service docker start sudo: /sbin/service: command not found
    and this one
    sudo service docker start sudo: service: command not found

  • What is the OS of the EC2 AMI you used?

  • Sorry, it may be "/usr/sbin" instead of "/sbin". Change all of the above steps to the path "/usr/sbin" and try again.

    export PATH=$PATH:/usr/sbin
    
    sudo /usr/sbin/service docker start
    
  • @Riku, to answer your question: What is the OS of the EC2 AMI you used? --> Amazon Linux Change all of the above steps to the path "/usr/sbin" and try again. --> Done.

    The Result:

    source ~/.bash_profile [cloudshell-user@ip-10-4-189-71 ~]$ sudo /usr/sbin/service docker start sudo: /usr/sbin/service: command not found [cloudshell-user@ip-10-4-189-71 ~]$ export PATH=$PATH:/usr/sbin [cloudshell-user@ip-10-4-189-71 ~]$ sudo /usr/sbin/service docker start sudo: /usr/sbin/service: command not found

  • It appears from your response that you are using CloudShell, but CloudShell cannot launch Docker. https://docs.aws.amazon.com/cloudshell/latest/userguide/vm-specs.html

    Currently, the AWS CloudShell compute environment doesn't support Docker containers.

    You are most likely not executing commands on EC2.

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ