how to create an ubuntu environment when using Docker on MAC computer with django

Viewed 142

I am super new to Docker and i am trying to grasp a concept.

Goal: I am trying to create this tech stack

create a Ubuntu OS
install python
install django/DRF
install postgresql
install reactJS

So far I have only been able to install python, django...

Dockerfile

FROM python:3.7

ENV PYTHONUNBUFFERED 1

WORKDIR /code

COPY requirements.txt /code

RUN pip install -r requirements.txt

COPY . /django-docker/

Docker compose

version: '3.7'

services:
  web:
    build: .
    command: python /code/manage.py runserver 0.0.0.0:8000
    volumes:
      - .:/code
    ports:
      - 8000:8000

My question is mainly on how do I install or add Ubuntu on the tech stack mentioned above or is it really necessary to have Ubuntu if i intend to deploy my tech stack to AWS in the future so other developers can work on the same project quickly when they setup their machines?

1 Answers

If you see your Dockerfile, you have specified base image as python:3.7.

If you visit the dockerfile of the base image python:3.7 here, you can see that basically you are installing a debian os and then python.To be more clear,If the image name is python:3.7, you get a docker image of debain with python 3.7 installed.

Now if you want to install ubuntu, you can set the base image as ubuntu:[tag] and then install each dependencies (python 3.7 , django,postgresql,reactsjs).

You can view this article which will help you to decide base docker image for your use case.

Related