Samba Container Build
Built from appcontainers/centos66
Build container using default values.
docker build -t appcontainers/samba .
Running the container
The container is built to allow several configurable variables to be passed in at runtime. The values are as follows:
ENV SMB_USER samba
ENV SMB_PASS password
- SMB_USER - The username that samba will use in order to connect to the /home and /public samba shares.
- SMB_PASS - The password of the samba user to connect to the /home and /public samba shares.
Run the container using default values
docker run -d -it --name samba -h samba -p 138:138/udp -p 139:139 -p 445:445 -p 445:445/udp appcontainers/samba
This will assume the following
- SMB_USER = samba
- SMB_PASS = password
Example: If you have an apache server where the application runs in either /home or /var/www/html (public)
You can start the apache container as normal making the /var/www/html a data volume, and then connect to it via this
docker run -d -it --name apache -h apache -p 80:80 -p 443:443 -v /var/www/html yourrepo/apache
Run the container substituting the $varables with your own custom values and attach to the example apache server above
docker run -d -it \ --name samba \ -h samba \ -p 138:138/udp \ -p 139:139 \ -p 445:445 \ -p 445:445/udp \ --volumes-from apache \ -e SMB_USER='admin' \ -e SMB_PASS='connect' \ appcontainers/samba
In this instance connecting to the samba server via your client, would present the /var/www/html folder contents of the
apache server running the data volume as indicated in the --volumes-from apache line in the docker run statement when
starting the samba container.
The container can also be started as a standalone samba container without the --volumes-from line, in which case will only
share the local /home and /var/www/html directories residing on the samba container.
Navigate to the IP address of the server using either the //serverip from windows or CMD+K -> smb://serverip from OSX in order to access the samba shares running on the samba container.