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
Today we are going to make origami airplanes (the...
There was no problem connecting to the database y...
This article example shares the specific code for...
Go to https://dev.mysql.com/downloads/mysql/ to d...
question: The following error occurred when insta...
Recently, an error occurred while starting MySQL....
Table of contents for loop While Loop do-while lo...
The docker exec command can execute commands in a...
I haven't worked with servers for a while. No...
illustrate In front-end development, you often en...
Table of contents Preface JavaScript find() Metho...
This topic is an internal sharing in the second h...
method: Take less in the actual project as an exa...
1. Meaning of partition table A partition table d...
MySQL and connection related timeouts Preface: To...