Why can't I call the Docker command with PHP?

Source: Internet
Author: User
Tags php cli docker run

  
   

Results

total 24drwxr-xr-x 2 root root 4096 Jun 23 16:24 .drwxr-xr-x 3 root root 4096 Jun 23 15:30 ..-rw-r--r-- 1 root root    1 Jun 23 15:42 index.html-rw-r--r-- 1 root root  215 Jun 23 16:24 index.php

Using PHP./index.php
System ("sudo docker ...") is capable of executing
cannot be performed with browser access

Reply content:


  
   

Results

total 24drwxr-xr-x 2 root root 4096 Jun 23 16:24 .drwxr-xr-x 3 root root 4096 Jun 23 15:30 ..-rw-r--r-- 1 root root    1 Jun 23 15:42 index.html-rw-r--r-- 1 root root  215 Jun 23 16:24 index.php

Using PHP./index.php
System ("sudo docker ...") is capable of executing
cannot be performed with browser access

should be due to insufficient PHP permissions, you can return the system after the execution of the status code to look at, want to see the specific return results can be used with the EXEC command.

You do in the browser is the WWW user, if you use the PHP command line (PHP CLI) to execute, it is your current user, the current user has permission to run successfully.

The reason should be insufficient authority, upstairs has been said very clearly.

I say the other solution is that PHP can directly use the Docker Remote API to work with Docker
can refer to http://www.open-open.com/lib/view/open1419921028828.html

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.