Reputation: 907
I am building Django app where I want to run Django and playwright images in 1 container in Docker Desktop (locally).
Below you can see my docker-compose.yml
file:
version: '3.8'
services:
web:
build: ./docker_playwright_test
command: python manage.py runserver 0.0.0.0:8000
volumes:
- ./docker_playwright_test/:/usr/src/docker_playwright_test/
ports:
- 8000:8000
Django is running fine on my localhost but I am not sure how to add Playwright image to docker-compose file?
Upvotes: 2
Views: 5161
Reputation: 44
Step 1: make sure you're in Linux Container in Docker.
Step 2: Go to C:\Users\[User Name]\.docker\config.json
Replace credsStore to credStore
Step 3: create Dockerfile, .dockerignore and docker-compose.yml file
Step 4: docker-compose format.
version: "3.9"
services:
frontend:
build: .
ports:
- "8000:80"
backend:
image: "mcr.microsoft.com/mssql/server"
environment:
SA_PASSWORD: "Docker123!"
ACCEPT_EULA: "Y"
ports:
- "1440:1433"
try to use sam ports as I mentioned here.
User = sa
, Database = master
It will run perfectly fine. IA.
Upvotes: 2
Reputation: 2659
You can add the Dockerfile within the service and build key (with configuration options applied at build time), like this:
web:
build:
context: .
dockerfile: Dockerfile
then, you can specify the Docker image in the specified Dockerfile, like this:
FROM mcr.microsoft.com/playwright:bionic
WORKDIR /docker_playwright_test
RUN npm install
COPY . ./
Otherwise, you can specify the Docker image in the docker-compose file in the service section:
web:
image: mcr.microsoft.com/playwright:bionic
volumes:
- ./docker_playwright_test/:/usr/src/docker_playwright_test/
ports:
- 8000:8000
Upvotes: 3