How can I allow my SQL Server container created by the Jenkins contaner to get the file view . Bak from my host?

Asked

Viewed 24 times

0

I would like my SQL Server container created by the Jenkins contaner to get the file view. Bak from my host so that I can restore some banks. How can I accomplish this task?

  1. Details of my environment:

I use windows 10 pro and WSL (windows Subsystem for linux). I created a Jenkins container on Docker that mounts my dev environment infrastructure. It is the 'host' environment of the Sql Server container and almost my entire infra. About the host and container daemons I have binded between these daemons.

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 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 of my Jenkins is located:

C: Infra_agil Jenkins projects

The sqlserver Docker-Compose is located:

C: Infra_agil Jenkins infra_common sql-server projects

Backup files are located:

C:\Projetos\infra_agil\jenkins\database\backups

Below an image that shows the location of these files.

Árvore do diretório

I’ve run several tests. In one of them I managed to bind between the backups folder of the host - Jenkins - and the sql server but the sql-server container could not see the files inside the folder, only Jenkins could see.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.