简体   繁体   English

如何在带有 django 的 MAC 计算机上使用 Docker 时创建 ubuntu 环境

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

I am super new to Docker and i am trying to grasp a concept.我对 Docker 非常陌生,我正在尝试掌握一个概念。

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...到目前为止,我只能安装 python、django...

Dockerfile 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 Docker 组成

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?我的问题主要是关于如何在上面提到的技术堆栈上安装或添加Ubuntu或者如果我打算将来将我的技术堆栈部署到 AWS 是否真的需要 Ubuntu 以便其他开发人员可以在同一项目上快速工作他们设置他们的机器?

If you see your Dockerfile, you have specified base image as python:3.7 .如果您看到 Dockerfile,则您已将基本映像指定为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. 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安装了 python 3.7。

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). 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.您可以查看这篇文章,它将帮助您为您的用例确定基本 docker 映像。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 docker 创建应用程序并仍然在主机上运行 psutil? - How to create an application using docker and still run psutil on hosts computer? 如何使用 Unix 环境在 django 中创建超级用户 - How to create superuser in django using Unix Environment 如何在设置Django测试环境时创建外部数据库? - How to create an external database when setting up Django test environment? Docker和Conda:在Mac和Ubuntu上构建相同容器的差异 - Docker and Conda: Differences when building the same container on Mac and on Ubuntu 如何使用适用于 Python 3.7 的 virtualenv 创建虚拟环境,而无需在我的计算机(Ubuntu 16.04.6 LTS x64)上安装 Python 3.7? - How can I create a virtual environment with virtualenv for Python 3.7 without having to install Python 3.7 on my computer (Ubuntu 16.04.6 LTS x64)? 如何在不创建虚拟环境的情况下使用Django和docker-compose解决reportMissingModuleSource? - How can I solve the reportMissingModuleSource by using Django and docker-compose without creating a virtual environment? Ubuntu为Django设置环境变量 - Ubuntu Setting Environment Variables for Django 如何在Ubuntu上设置本地Django开发环境? - How do I setup a local Django development environment on Ubuntu? Django - Mac 开发,环境地狱 - Django - Mac development, environment hell 当我在ubuntu16.04上使用Django项目时,Permmison拒绝创建文件夹 - Permmison Denied to create folders When I using Django project on ubuntu16.04
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM