Closed farzadha2 closed 1 year ago
Hello!
If you bind mount on top of a filesystem this action will hide the contents of that folder with the mount, as explained here.
Maybe for tests you can bind another path, copy the samba content with the container running, and after that bind it to the correct path. Any trouble please let me know.
Thank you so much for the reply, So these were the steps i took on the docker compose
created folder on host
mkdir /ad/data/
then on my docker compose added this
version: "3.1"
services:
dc1:
image: samba:almalinux
restart: unless-stopped
network_mode: host
build:
context: .
dockerfile: dockerfiles/almalinux
container_name: dc1
hostname: DC1
privileged: true
environment:
REALM: COORP.LOCAL
DOMAIN: COORP
ADMIN_PASS: Passw0rd
DNS_FORWARDER: 8.8.8.8
volumes:
- dc1-local-samba:/usr/local/samba
- /ad/data/:/root
volumes:
dc1-local-samba:
then in the container copied
cd /usr/local/
cp -r samba/ /root/
then went back to docker-compose changed the volume
version: "3.1"
services:
dc1:
image: samba:almalinux
restart: unless-stopped
network_mode: host
build:
context: .
dockerfile: dockerfiles/almalinux
container_name: dc1
hostname: DC1
privileged: true
environment:
REALM: COORP.LOCAL
DOMAIN: COORP
ADMIN_PASS: Passw0rd
DNS_FORWARDER: 8.8.8.8
volumes:
- /ad/data/samba:/usr/local/samba
then docker-compose up -d
checking logs im seeing this
No log line matching the '' filter
any ideas what else i missed?
Thank you
Maybe the problem is with the /root, try to bind to another file location and copy the files again.
First compose file:
volumes:
- ./samba:/samba
Copy:
docker exec dc1 cp -r /usr/local/samba /
Change compose file:
volumes:
- ./samba:/usr/local/samba
Thank you for the quick reply, it seems that it works but when i try to check the logs it shows empty
Thank you
It didn't show up because all the samba changes were made before the container stop, so when it restarted there was nothing to log. If you try the samba tests it should be fine. If you have any problems, please let me know.
Thank you so much for the reply, can you let me know where do the samba logs are stored? so when i restart the container or remove the container the logs wont show anymore?
Thank you
The samba -F
show logs in STDOUT and STDERR by default, you can change log level and location changing the smb.conf as described here, but I don't know if it will show the logs made by the initialization scripts from the sbin folder, since them throws info to the standard output.
Thank you so much for the reply, it seems that the logs are located in
/usr/local/samba/var/log
So i reinstalled the docker container as it was before and these are the logs that i normally see which im guessing its the initialization scripts
is there a way after changing the mount location that the initialization scripts of the docker would appear again?
root@dockers2:/ad/samba-ad-dc# docker-compose logs
dc1 | INFO 2023-03-02 18:47:26,824 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #2108: Looking up IPv4 addresses
dc1 | INFO 2023-03-02 18:47:26,826 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #2125: Looking up IPv6 addresses
dc1 | WARNING 2023-03-02 18:47:26,827 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #2132: No IPv6 address will be assigned
dc1 | INFO 2023-03-02 18:47:27,319 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #2274: Setting up share.ldb
dc1 | INFO 2023-03-02 18:47:27,335 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #2278: Setting up secrets.ldb
dc1 | INFO 2023-03-02 18:47:28,135 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #2283: Setting up the registry
dc1 | INFO 2023-03-02 18:47:29,157 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #2286: Setting up the privileges database
dc1 | INFO 2023-03-02 18:47:30,598 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #2289: Setting up idmap db
dc1 | INFO 2023-03-02 18:47:31,347 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #2296: Setting up SAM db
dc1 | INFO 2023-03-02 18:47:31,351 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #880: Setting up sam.ldb partitions and settings
dc1 | INFO 2023-03-02 18:47:31,351 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #892: Setting up sam.ldb rootDSE
dc1 | INFO 2023-03-02 18:47:31,355 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #1305: Pre-loading the Samba 4 and AD schema
dc1 | Unable to determine the DomainSID, can not enforce uniqueness constraint on local domainSIDs
dc1 |
dc1 | INFO 2023-03-02 18:47:31,377 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #1383: Adding DomainDN: DC=coorp,DC=local
dc1 | INFO 2023-03-02 18:47:31,386 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #1415: Adding configuration container
dc1 | INFO 2023-03-02 18:47:31,396 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #1430: Setting up sam.ldb schema
dc1 | INFO 2023-03-02 18:47:38,079 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #1448: Setting up sam.ldb configuration data
dc1 | INFO 2023-03-02 18:47:38,311 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #1489: Setting up display specifiers
dc1 | INFO 2023-03-02 18:47:41,274 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #1497: Modifying display specifiers and extended rights
dc1 | INFO 2023-03-02 18:47:41,330 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #1504: Adding users container
dc1 | INFO 2023-03-02 18:47:41,332 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #1510: Modifying users container
dc1 | INFO 2023-03-02 18:47:41,333 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #1513: Adding computers container
dc1 | INFO 2023-03-02 18:47:41,335 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #1519: Modifying computers container
dc1 | INFO 2023-03-02 18:47:41,336 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #1523: Setting up sam.ldb data
dc1 | INFO 2023-03-02 18:47:41,529 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #1553: Setting up well known security principals
dc1 | INFO 2023-03-02 18:47:41,592 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #1567: Setting up sam.ldb users and groups
dc1 | INFO 2023-03-02 18:47:42,026 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #1575: Setting up self join
dc1 | Repacking database from v1 to v2 format (first record CN=Schema-ID-GUID,CN=Schema,CN=Configuration,DC=coorp,DC=local)
dc1 | Repack: re-packed 10000 records so far
dc1 | Repacking database from v1 to v2 format (first record CN=user-Display,CN=419,CN=DisplaySpecifiers,CN=Configuration,DC=coorp,DC=local)
dc1 | Repacking database from v1 to v2 format (first record CN=6bcd5685-8314-11d6-977b-00c04f613221,CN=Operations,CN=DomainUpdates,CN=System,DC=coorp,DC=local)
dc1 | INFO 2023-03-02 18:47:45,084 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/sambadns.py #1198: Adding DNS accounts
dc1 | INFO 2023-03-02 18:47:45,101 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/sambadns.py #1232: Creating CN=MicrosoftDNS,CN=System,DC=coorp,DC=local
dc1 | INFO 2023-03-02 18:47:45,124 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/sambadns.py #1245: Creating DomainDnsZones and ForestDnsZones partitions
dc1 | INFO 2023-03-02 18:47:45,176 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/sambadns.py #1250: Populating DomainDnsZones and ForestDnsZones partitions
dc1 | Repacking database from v1 to v2 format (first record DC=_msdcs,DC=coorp.local,CN=MicrosoftDNS,DC=DomainDnsZones,DC=coorp,DC=local)
dc1 | Repacking database from v1 to v2 format (first record DC=_ldap._tcp.Default-First-Site-Name._sites.dc,DC=_msdcs.coorp.local,CN=MicrosoftDNS,DC=ForestDnsZones,DC=coorp,DC=local)
dc1 | INFO 2023-03-02 18:47:46,007 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #2012: Setting up sam.ldb rootDSE marking as synchronized
dc1 | INFO 2023-03-02 18:47:46,010 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #2017: Fixing provision GUIDs
dc1 | INFO 2023-03-02 18:47:47,689 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #2348: A Kerberos configuration suitable for Samba AD has been generated at /usr/local/samba/private/krb5.conf
dc1 | INFO 2023-03-02 18:47:47,690 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #2350: Merge the contents of this file with your system krb5.conf or replace it with this one. Do not create a symlink!
dc1 | INFO 2023-03-02 18:47:47,901 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #2082: Setting up fake yp server settings
dc1 | INFO 2023-03-02 18:47:48,002 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #487: Once the above files are installed, your Samba AD server will be ready to use
dc1 | INFO 2023-03-02 18:47:48,002 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #492: Server Role: active directory domain controller
dc1 | INFO 2023-03-02 18:47:48,002 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #493: Hostname: DC1
dc1 | INFO 2023-03-02 18:47:48,002 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #494: NetBIOS Domain: COORP
dc1 | INFO 2023-03-02 18:47:48,002 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #495: DNS Domain: coorp.local
dc1 | INFO 2023-03-02 18:47:48,003 pid:16 /usr/local/samba/lib64/python3.9/site-packages/samba/provision/__init__.py #496: DOMAIN SID: S-1-5-21-3715842146-1889575511-1905694483
Thank you
When you stop and start with docker compose, another container is created with another ID, and all logs from the initialization are lost with the container, since them are printed to its stdout and stderr. Maybe you can edit the init command to throw all script output to a file, adding to the docker-compose to something like:
services:
dc1:
command: bash -c "samba-domain-provision | tee >>/usr/local/samba/var/log.provision 2>&1 && samba -F"
Thank you for the reply, oh gotcha, did not know. currently im getting this
version: "3.1"
services:
dc1:
command: bash -c "samba-domain-provision | tee >>/usr/local/samba/var/log.provision 2>&1 && samba -F"
image: samba:almalinux
restart: unless-stopped
network_mode: host
build:
context: .
dockerfile: dockerfiles/almalinux
container_name: dc1
hostname: DC1
privileged: true
environment:
REALM: COORP.LOCAL
DOMAIN: COORP
ADMIN_PASS: Passw0rd
DNS_FORWARDER: 8.8.8.8
volumes:
# - dc1-local-samba:/usr/local/samba
- ./samba:/usr/local/samba
Thank you again
You need to delete all and recreate the environment again, the script doesn't do nothing if already executed:
docker compose down -v
docker compose up -d
Maybe all the process from the bind mount and copy should be done.
thanks you so much that did the trick
Hi I wanted to thank you for the amazing docker container really works greats, I currently have it installed but with volume, but wanted to create though bind mounts, i was reading https://github.com/docker/docs/issues/2979#issuecomment-296289081 but not sure how i can apply on the docker compose Which shows the issue to copy because im getting the issue
currently this is my docker compose
i was reading abit and i also tried on the dockerfile add this part
but still having the same issue not sure if there is another way to save it on another directory?
Thank you