Docker: Problem with smb

Created on 19 May 2019  路  7Comments  路  Source: nextcloud/docker

I used this to start the docker image:
docker run --name nextcloud \
-v nextcloud:/var/www/html \
-v apps:/var/www/html/custom_apps \
-v config:/var/www/html/config \
-v data:/var/www/html/data \
-v theme:/var/www/html/themes \
-e MYSQL_HOSTNAME=myhost \
-e MYSQL_PORT=3306 \
-e MYSQL_DATABASE=nextcloud_db \
-e MYSQL_USER=nextcloud \
-e MYSQL_PASSWORD=xxx \
-e NEXTCLOUD_ADMIN_USER=xxx\
-e NEXTCLOUD_ADMIN_PASSWORD=xxx \
-d -p 8081:80 nextcloud

Then I tried to install php smb:
:/var/www/html# apt install php-smbclient
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php-smbclient

installation of smbclient was working:
/var/www/html# apt install smbclient
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
..... etc.....

BUT when I configure external storage I get this in the docker logs:
mkdir failed on directory /var/run/samba/msg.lock: Permission denied

Most helpful comment

@wolftobias Install clear image first. Then:

  1. docker exec -it nextcloud-container bash
  1. All further commands you should run inside the container:
apt update
apt install libsmbclient-dev
pecl install smbclient
echo "extension=smbclient.so" > /usr/local/etc/php/conf.d/docker-php-ext-smbclient.ini
exit
  1. docker restart nextcloud-container

That's all

All 7 comments

My solution is:

apt install libsmbclient-dev
pecl install smbclient
echo "extension=smbclient.so" > /usr/local/etc/php/conf.d/docker-php-ext-smbclient.ini

Then docker restart nextcloud

I don't know why developers didn't include this package... Should I make PR for this?

Yes also for my opinion this should be included, PR makes sense for me. I was looking for hours for a working solution.

For it`s not working, still same issue:
mkdir failed on directory /var/run/samba/msg.lock: Permission denied

I use latest nextcloud docker image, the steps are reproduceable....

@wolftobias Install clear image first. Then:

  1. docker exec -it nextcloud-container bash
  1. All further commands you should run inside the container:
apt update
apt install libsmbclient-dev
pecl install smbclient
echo "extension=smbclient.so" > /usr/local/etc/php/conf.d/docker-php-ext-smbclient.ini
exit
  1. docker restart nextcloud-container

That's all

If you run exactly the same commands you'll not have samba in your container (only smbclient-php), so it will not be able to print error you mentioned above:

mkdir failed on directory /var/run/samba/msg.lock: Permission denied

oh man, I was missing the last step, thought this was a comment....
echo "extension=smbclient.so" > /usr/local/etc/php/conf.d/docker-php-ext-smbclient.ini

now it`s working!
Why not including smb into the big apache image?!

Was this page helpful?
0 / 5 - 0 ratings