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.

preguntada hace un año4014 visualizaciones
1 Respuesta
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
EXPERTO
respondido hace un año
  • 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.

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas