Simple application deployment 1. Directory structure:
2. Write the Dockerfile file
3. Create a container image docker build -t test . 4. Run the container docker run -it --name test --restart always --privileged=true python-test --restart: always The container is always restarted when it exits. --privileged=true: The permissions required to execute files in the container. Django application containerization 1. Directory structure, I assume that this directory exists in /home/Pythonpro.
run.sh script python /code/manage.py runserver 0.0.0.0:8000 2. Write the Dockerfile file FROM python:3.6.4 RUN mkdir /code \ &&apt-get update \ &&apt-get -y install freetds-dev \ &&apt-get -y install unixodbc-dev COPY ./code RUN pip install -r /code/requirements.txt -i https://pypi.douban.com/simple WORKDIR /code CMD ["/bin/bash","run.sh"] 3. Build an Image docker build -t webtest . 4. Run the container docker run -it -p 6500:8000 -v /home/Pythonpro:/code --name web --restart always --privileged=true webtest -p: Map the container's port 8000 to the host's port 6500 -v: The host directory /home/Pythonprot is mapped to the container directory /code --name: specifies the name of the container as web, the image just built by webtest --restart: always The container is always restarted when it exits --privileged=true: Permissions required to execute files in the container The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Markup language - CSS layout
>>: Native JS to achieve digital table special effects
What is the purpose of creating your own website u...
Since the standard ab only supports stress testin...
Preparation: 1. Install VMware workstation softwa...
Benefits of using xshell to connect to Linux We c...
Overview The prototype pattern refers to the type...
Table of contents JSX environment construction Se...
First, let’s take a look at the picture: Today we...
1. Download 1. Click the latest download from the...
1. Virtual environment virtualenv installation 1....
How to install MySQL 5.7 in Ubuntu 16.04? Install...
Friends who have some basic knowledge of SQL must...
Main library binlog: # at 2420 #170809 17:16:20 s...
This article describes the MySQL transaction mana...
In web page production, displaying and hiding ele...
This article uses examples to illustrate the prin...