Run cmd Pull base image from MS: $docker pull microsoft/mssql-server-windows Cd to folder contain db files (.mdf, ldf), ex: App_Data folder, should be copy DB file to others folder to easy using it Create Dockerfile(file with no extension) in DB folder with content # using vNext image FROM microsoft/mssql-server-windows # create directory within SQL container for database files RUN powershell -Command (mkdir C:\\SQLServer) #copy the database files from host to container COPY docker_test.mdf C:\\SQLServer COPY docker_test_log.ldf C:\\SQLServer # set environment variables ENV sa_password=sa!123 ENV ACCEPT_EULA=Y ENV attach_dbs="[{'dbName':'docker_test','dbFiles':['C:\\SQLServer\\docker_test.mdf','C:\\SQLServer\\docker_test_log.ldf']}]" $docker build -t demo-db . at db folder to build sqldb image $docker run -d -p 1433:1433 --name demo-db-container demo-db to run a containers of...
Nhận xét
Đăng nhận xét