- Create the docker group using the following command: sudo groupadd docker
- Add your user to this group with the following command (assuming adding current user): sudo usermod -aG docker $USER
- Verify that your user has been added to the docker group by listing the users of the group: groups $USER
- Log out and log back in again for the changes to take effect.
system('docker version') doesn't return zero
3 views (last 30 days)
Show older comments
MathWorks Support Team
on 4 Jan 2024
Edited: MathWorks Support Team
on 4 Jan 2024
I am trying to use one of the docker functions below for my deployment workflow.
compiler.package.docker
compiler.package.microserviceDockerImage
compiler.runtime.createDockerImage
compiler.runtime.createInstallerDockerImage
I run into below error when I run the command:
In order to use <function> you must be able to run in MATLAB: system('docker version') and it should return zero.
When I run "system('docker version')", it returns one and there seems an issue.
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock:
What should I do?
Accepted Answer
MathWorks Support Team
on 4 Jan 2024
Edited: MathWorks Support Team
on 4 Jan 2024
If you run command "docker version" in terminal, you should get same output as running "system('docker version')". It is not an issue related to MATLAB.
The error message “permission denied while trying to connect to the Docker daemon socket” usually occurs when the user does not have the necessary permissions to access the Docker daemon socket. To fix the error, you can Create a docker group and add your user to this group. Please refer to this link for detailed instructions Manage Docker as a non-root user. Below is a quick reference.
After following these steps, make sure you don't see any errors when running "docker version" in terminal and you get zero return in MATLAB with "system('docker version')". Then you should be able to use aforementioned docker functions.
0 Comments
More Answers (0)
See Also
Categories
Find more on Containers in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!