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.

질문됨 일 년 전4005회 조회
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
전문가
답변함 일 년 전
  • 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.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠