I would like my SQL Server container created by the jenkins contaner to be able to view my host's .bak files and thus be able to restore some banks. How can I accomplish this task?
Details of my environment: I use windows 10 pro and WSL (windows subsystem for linux). I created a jenkins container on the docker that assembles my local dev environment infrastructure. It is the host environment of the Sql Server container and almost all of my infrastructure. About docker daemons I binded between these daemons (host and jenkins daemon).
docker-compose from my jenkins
version: "3.7"
#Volume to sql-server-container-dev
volumes:
jenkins-dev:
name: jenkins-dev
services:
jenkins-dev-service:
container_name: jenkins-dev
hostname: windows-host
build:
context: .
dockerfile: Dockerfile
image: jenkins-image-dev
ports:
- "8080:8080"
volumes:
#Bind o daemon docker do host para o container
- '//var/run/docker.sock:/var/run/docker.sock'
#Dependencia abstrata
- 'C:/Projetos/infra_agil/jenkins:/jenkins'
docker compose from my sql server
version: "3.7"
networks:
sql-server-network:
driver: bridge
volumes:
jenkins-dev:
external: true
services:
# Habilite Filesharing se não o sql server não irá subir
sql-server-db:
container_name: sql-server-container-dev
build:
context: .
dockerfile: Dockerfile
image: sql-server:2019
volumes:
- type: volume
source: jenkins-dev
target: /backups
ports:
- "1433:1433"
networks:
- sql-server-network
The docker-compose from my jenkins is located:
C:\Projetos\infra_agil\jenkins
The sqlserver docker-compose is located:
C:\Projetos\infra_agil\jenkins\infra_comum\sql-server
The backup files are located:
C:\Projetos\infra_agil\jenkins\database\backups
Image that shows the location of these files. Image of Directory
I've done several tests. In one of them I managed to 'bind' between the backups folder of the host - jenkins - and the sql server container. However, the sql-server container could not see the files inside the folder, only jenkins could see it.