Search code examples
pythondjangodockerdocker-composeplaywright

how to add playwright docker image to docker compose?


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?


Solution

  • 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.