Docker Administration: SMB share and Docker volumes

Background:

Recently I’ve been setting up a Docker lab environment to run some applications and needed some data to persist and be shared across my lab network. Since most of the computers run Windows, using SMB shares seems to be the easiest solution.

Related articles:

Configurations:

Create a Docker CIFS/Samba volume:

# Assuming that the network share is at:
\\main_server\DockerShare

# Create a docker volume:
docker volume create --driver local --opt type=cifs --opt device=//main_server/DockerShare --opt o=addr=main_server,username=your_username,password=your_password,file_mode=0777,dir_mode=0777 --name my_smb_vol

Run a container with a volume mount:

# List all volumes
docker volume ls

# Run a container with the volume that's been created:
docker run -dit --name WEB_SERVER --network docker_dev_net --ip 192.168.1.103 --mount source=my_smb_vol,destination=/SharedVolume -p 443:443 -p 80:80 -p 22:22 ubuntu