• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question Interacting with docker via command line

Marco T.

New Pleskian
Hello,

how am I supposed to interact with docker from the command line? I tried to do a simple "docker ps" but the result was:

Cannot connect to the Docker daemon. Is the docker daemon running on this host?

Thanks.
 
PS: I would need also help for managing network access. It seems that the docker containers cannot resolve any DNS query.
 
Hello,

I'm running as the default ubuntu user in Ubuntu 16.04. The result is this:
Code:
ubuntu@dev:/home$ service docker status                                                 
● docker.service - Docker Application Container Engine                                 
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2017-01-13 16:33:38 CET; 4 days ago               
     Docs: https://docs.docker.com                                                     
 Main PID: 5129 (dockerd)                                                               
    Tasks: 74                                                                           
   Memory: 35.2M                                                                       
      CPU: 8min 49.537s                                                                 
   CGroup: /system.slice/docker.service
...
 
As the service is obviously running, most likely cause for the issue that you have described is, that your user account does not have root privileges. To run "docker ps" you must either have root privileges or use the "sudo" prefix command for temporary root permissions. Alternatively you can add your user to the docker group on your system, like "sudo usermod -aG docker $(whoami)".
 
Wow, I actually forgot to use "sudo". It works fine using it. Could you please also tell me how to get the containers connected to the internet?
 
Well, the containers are actually "always on" (when they are running), but if you have set "automatic port mapping", they might use different ports each time they are running (if they need ports at all). What you will need to do is to choose "manual port mapping", then set a port and then create a proxy rule from the "Docker Proxy Rules" icon of the corresponding subscription. This way you can tell the server to translate incoming requests on e.g. a standard port to the specific port of the Docker container you are using on that site. More information on that: https://docs.plesk.com/en-US/onyx/a...esk-administration/using-docker.75823/#o77139
 
Maybe I wasn't clear, I have no issues in using the containers, even via Docker Proxy Rules, but the containers themselves can't reach the internet or resolve DNS queries, like if their networking bridge is host-only.
 
Back
Top