Coder Social home page Coder Social logo

leandro4002 / docker-samba Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ahmetozer/docker-samba

0.0 0.0 0.0 21 KB

It's a container image. It has a auto configrator tool to easy and fast install. You can manage your network shares with single commands.

Home Page: https://hub.docker.com/r/ahmetozer/samba

License: MIT License

Shell 97.27% Dockerfile 2.73%

docker-samba's Introduction

Samba for Docker Containers

Easy to use samba file share server for docker containers.

Getting Container Image

For the installation you can use docker pull command to get samba container

docker pull ahmetozer/samba

If you want to build in your computer you can use git and docker build

git clone [email protected]:AhmetOZER/docker-samba.git
cd docker-samba
docker build -t samba .

Basic Run

It is easy to use and configure with automated script.

docker run -it ahmetozer/samba

Accessing container network

There is a few option at this point. First one is 1 docker container and share with docker-proxy with -p argumant.

docker run -it -p 445:445 ahmetozer/samba 

Second one is without port share. Each docker container has a own static IP address and it is accessible only local network.

docker run -it ahmetozer/samba --ip 172.17.0.80

Share Folders With Samba Container

If you want to share outside of folder you can use -v argumant while creating docker. -v has a ":" to bind local and container folder. Before the ":" it's your server directory, after the ":" it's your container directory For example your website files at /var/www directory and you want to share your web folder with samba.

server:~# docker run -it -v/var/www:/share/web ahmetozer/samba
Hello. You are installing samba server
username » root
Please enter password (at least 8 character) random password 1dM3ltN6 »
Please retype password »
New SMB password:
Retype new SMB password:
Added user root.
Share Name » web
Share Comment » web Directory
Share path » /share/web
Valid users for web » root
Re generating config file
Reloading samba service

Container Commands

This script also has a some basic futures.

Add User

To add new user in samba container

useradd

Example

36f60553d4aa:/# useradd
username » web
Please enter password (at least 8 character) random password AjNvK3Gb »
Please retype password »
New SMB password:
Retype new SMB password:
Added user web.
Reloading samba service

###   OR
36f60553d4aa:/# useradd root3 mypassword
New SMB password:
Retype new SMB password:
Added user root3.
Reloading samba service

###   OR
36f60553d4aa:/# useradd root5
Please enter password (at least 8 character) random password VsQLHn5C »
Please retype password »
New SMB password:
Retype new SMB password:
Added user root5.
Reloading samba service

Add Share

Add new folder share

Note: You can't add outside of docker container folder to share with samba after first run. If you want to share outside of the container folder, you have to use -v argument to bind Moby folder to container folder.

shareadd  

Example

36f60553d4aa:/# shareadd
Share Name » newshare
Share Comment » newshare Directory
Share path » /share/newshare
Valid users for newshare » newshare
Re generating config file
Reloading samba service

###   OR
36f60553d4aa:/# shareadd newshare "/share/newshare" "newshareuser" "newshare Directory"
Share Name » newshare
Share Comment » newshare Directory
Share path » /share/newshare
Valid users for newshare » newshareuser
Re generating config file
Reloading samba service

List Shares

You can see your shares in container with sharelist command.

sharelist

Example

36f60553d4aa:/# sharelist
newshare
root

Show Configure of Share

Show share samba configration.

shareshow

Example

36f60553d4aa:/# shareshow newshare
[newshare]
              comment = newshare Directory
              path = /share/newshare
              read only = No
              writeable = yes
              browsable = yes
              valid users = newshare
              public = no
              create mask = 0640
              directory mask = 0750
              guest ok = no

Update Samba Configuration

If you add new share without "shareadd" or "useradd" commands, like a add with custom config with nano, you can update configure and reload samba with update-samba.

update-samba

Example

36f60553d4aa:/# update-samba
Re generating config file
Reloading samba service

Delete Share

If you want to delete share in docker container, you can use sharedel command.

sharedel

Example

36f60553d4aa:/# sharedel newshare
Deleting file /etc/samba/conf.d/newshare.conf
Re generating config file
Reloading samba service

Reload Samba

To reload samba.

reload-samba

Fast Install

This script also has a fast install option. Set sharename variable to use fast install option.

server:/#docker run -v/var/www:/share/web -e sharename=web -it ahmetozer/samba
Your password is c3b-NbmV
New SMB password:
Retype new SMB password:
Added user root.
Re generating config file
Reloading samba service

If you don't want to use random password, set the password variable.

server:/#docker run -it -v/var/www:/share/web -e sharename=web -e password=1234578 ahmetozer/samba
New SMB password:
Retype new SMB password:
Added user root.
Re generating config file
Reloading samba service

OR you can set passato to no and script will be ask password in terminal

server:/#docker run --rm -it -e sharename=web -e passato=no ahmetozer/samba
Please enter password (at least 8 character) random password 8jUPPDVb »
Please retype password »
New SMB password:
Retype new SMB password:
Added user root.
Share name » web
share dir » /share/root
share comment » root directory
share valid users » root
Re generating config file
Reloading samba service

Fast install supported variables username, sharename, sharecomment, sharepath and passato.


Samba share configs are stored at /etc/samba/conf.d/ in docker container directory.

docker-samba's People

Contributors

ahmetozer avatar leandro4002 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.