diff --git a/Dockerfile b/Dockerfile index ae52e075..686dfc1c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,11 +8,10 @@ WORKDIR /app COPY . /app # Install necessary packages and any needed packages specified in requirements.txt -RUN apt-get update && apt-get install -y python3-dev python3-pip && pip install -r requirements.txt +RUN apt-get update && apt-get install -y python3-dev python3-pip sqlite3 && pip install -r requirements.txt # Make port 8000 available to the world outside this container EXPOSE 8000 # Run migrations and then start the server CMD ["sh", "-c", "python3 manage.py migrate && python3 manage.py runserver 0.0.0.0:8000"] - diff --git a/README.rst b/README.rst index 4099c6bf..fcad990d 100644 --- a/README.rst +++ b/README.rst @@ -114,18 +114,32 @@ the *Django Admin Interface* like this: Building with docker ==================== -Building image with the following command: +Building ``helloworld`` image with the following command: :: $ docker build --tag=helloworld . -Running the container with the following command: +Running the ``django-helloworld`` container with the following command: :: - $ docker run -p 4000:8000 helloworld + $ docker run docker run -p 4000:8000 --name django-helloworld -d helloworld + + +Checking the ``django-helloworld`` logs with the following command: + +:: + + $ docker logs -f django-helloworld + + +Stoping the ``django-helloworld`` container with the following command: + +:: + + $ docker stop django-helloworld Requesting the URL http://localhost:4000 with the following command: @@ -133,7 +147,13 @@ Requesting the URL http://localhost:4000 with the following command: :: $ curl localhost:4000 + Hello, world! Also you can request the URL http://localhost:4000 in your web browser you can see the hello world example. + +.. figure:: https://github.com/django-ve/django-helloworld/raw/master/docs/django_helloword_docker.png + :width: 315px + :align: center + :alt: A Django 'Hello World' example from a Docker container diff --git a/docs/django_helloword_docker.png b/docs/django_helloword_docker.png new file mode 100644 index 00000000..12c17552 Binary files /dev/null and b/docs/django_helloword_docker.png differ