Docker is running very slow in ubuntu 18.04 for a simple django hello world

52 Views Asked by At

I am just learning dockr generally but specifically for django. I am still very new to docker and all the question on SO does not seem to help me reduce the build time

I have tried to dockerize my hello wold app of django, it has taken moe than 3.5 hours for the process of downloading and extacting packages in docker, this seems to be part of a stage 1 of 5 stages in the building process. this is my dockerfile

# The first instruction is what image we want to base our container on
# We Use an official Python runtime as a parent image
FROM python:3.6

# set environment variables  
#ENV PYTHONDONTWRITEBYTECODE =1
ENV PYTHONBUFFERED = 1  

# where your code lives  
WORKDIR /app  

## Allows docker to cache installed dependencies between builds
COPY requirements.txt requirements.txt

# install dependencies  
#RUN pip install --upgrade pip  
 
# run this command to install all dependencies  
RUN pip install -r requirements.txt 

##old docker file start
## Allows docker to cache installed dependencies between builds
#COPY requirements.txt requirements.txt
#RUN pip install --no-cache-dir -r requirements.txt


# copy whole project to your docker home directory. 
COPY . . 

EXPOSE 8000

CMD python3 manage.py runserver

Also from what I coul see there were 12 files downloaded by docker during the building, 9 files were extracted but 3 files were yet to be extracted before i had to shutdown the system. All these are part of stage 1 of 5 stages.

The current os i am using i just reinstalled ubuntu 18.04 . But before re-installing ubuntu 18.04 the former docker which i installed, when i shutdown the system, the next time I switched it on to continue the building it did not continue with stage 1 and there where like 4 files which had not been extrcated then in that stage 1. It just went stright to stage 2.

  1. How can I make docker to build docker faster
  2. How can i make docker to continue the files it was working on before I shut it down

these are the files which is yet to be extracted

metadata for docker.io/library/python:3.6                                                          51.1s
=> [1/5] FROM docker.io/library/python:3.6@sha256:f8652afaf88c25f0d22354d547d892591067aa4026a7fa9a6819df9f300af6fc
sha256:f8652afaf88c25f0d22354d547d892591067aa4026a7fa9a6819df9f300af6fc 1.86kB / 1.86kB                           0.0s
=> =>  sha256:d097a4907a8ec079df5ac31872359c2de510f82214c0448e926393b376d3b60d 2.22kB / 2.22kB                           0.0s2
=> =>  sha256:54260638d07c5e3ad24c6e21fc889abbc8486a27634c0892086ff71f3f44b104 9.27kB / 9.27kB

This one was the last one that was extracted before shutting down the

sha256:c4f42be2be53b900ebffc040c1df13de538434ccc5f5d954a56848a6169a3a3f 2.21MB / 2.21MB

I want it to make sure the above is perfectly done and it complete the remaining operation in stage 1

Update This message is for @erik258 both OS were giving me error during installation. I could not make any comment. It is not responding

0

There are 0 best solutions below