killing docker container from docker desktop - django

Created an django app and dockerize it and then before I stopped the container I removed the app and then
I could not remove the container yet
Can you help me please to remove docker container
once I clicked remove button it says that
removing container from docker

Related

I can not see running docker compose containers on ubuntu 20.04

I have web app in 3 containers running on linux server (ubuntu 20.04), Django webapp, nginx webserver and postgres db. When i run 'docker-compose ps' it does not show any container, or error, only headings, like there is no container, not even crashed one.
I am sure that it is the right folder as there is no other docker-compose.yml on this server.
It seems almost like app is not running there except that it is accessible via browser and working well.
I tried all kinds of commands for showing containers or images using docker and docker-compose with no result
I tried docker service restart - app went offline for a moment and then back online (I have 'restart: allways' set in compose file) also I restarted the whole server with the same result.
Even script which is making db dumb does not see containers and started do fail
When I try to bring up the project running docker-compose up webapp and db containers starts but webserver not because port is already taken
Have anyone experienced this? I work with docker-compose for a while but it never happened to me before, I don't know what to do, I need to update the code of this application and I don't want to lose data in DB (I am also not able to make dump or ssh to the container).
This app was working for years with the same configuration before, on the other server with Ubuntu 18.04. Maybe it is server related problem.
Thanks.
It sounds like there is some fundamental problem going on. Have you tried using simply docker ps to see if your containers are running, or to see if anything is running?
If the containers are listed in the docker ps output, make sure you have the names correct in your docker-compose.yml
If you don't see your containers running with docker ps then maybe they crashed immediately after start (and are therefore no longer running).
I would have expected docker-compose ps to have shown something - even if your containers are crashing.
Please provide more details of your output from docker ps and/or docker-compose ps and maybe the contents of your docker-compose.yml if these things don't help. You said "it doesn't show any container" when you run docker-compose ps - does it show anything at all (errors, blank lines, etc.)

Dockerfile for .sqlite3 database

I currently have a Django application I want to deploy. The database being used is SQLite3 and I would like to run it in a separate container as the web application. I need to create a docker image of the Database and push it to my repo on AWS ECR. I already have an image of the application there but need a seperate image of the database so the data will persist. Any advice on creating a DockerFile or docker-compose file to do this would be great.

dockerize gunicorn, nginx, django in single container

i am trying to dockerize my django project using gunicorn and nginx. The setup works on my machine, but i can't get nginx to work with the unix socket inside the image.
i followed this tutorial. Since i can't use systemctl inside the container, i tried to run gunicorn as a CMD. To start Nginx, i tried restarting the container, but then my CMD is not restarted (i think?) and the container shuts down.
How should i properly reload the nginx service inside the docker container using my dockerfile?
You can use systemctl inside a container. Either configuring a systemd daemon inside the container, or using the docker-systemctl-replacement to do without. I am using that regularly to run multiple service inside one container.

Update Docker container after making changes to image

I am new to Docker and am experimenting with developing a Django App on Docker.
I have followed the example in this link here:
Currently I am developing my app and have made changes to various files within the web directory. For now in order to test my changes I have had to remove all my running containers, stop my docker machine, start my docker machine, attach docker machine, run docker-compose up. This is a timely process and is unproductive especially if I need to keep testing after small changes.
My question is if I make changes to the image (changes in the web directory) how can I update my container to reflect those changes or should I be doing things differently?
How do other people develop using Docker? what are your best practices?
You could use volumes to map host directory in container's web directory. Any changes in host directory will be reflected immediately without restarting container. See below post.
How to make a docker container directory accesible from host?
You can use docker-compose up --build to rebuild the image and container after making changes. It will automatically rebuild and restart any changed containers. There shouldn't be any reason to stop docker machine. If you are using a Mac or Windows PC, you can try the new beta app, which is a bit easier to use than prior versions.
Also see: https://docs.docker.com/compose/reference/
As for best practices, this probably isn't really the right forum unless you have a more specific question.

dockerize django apache developer environment

I tried to dockerize my django/apache web application.
In the big picture the dockerization worked out.
For deployment Annot is running in 3 containers. The apache_annot container holds the apache server and the postgresql database The media_annot container serves as web application media folder. The annot container holds the django python related code.
For development only 2 containers are needed: the apache_annot container and media_annot container. The django and python related code is placed into a directory at the host machine. apache_annot then simply mounts this directory as a data volume under /var/www/annot/.
Here the link to the Docker files:
https://gitlab.com/biotransistor/dock/tree/master
Issue:
Even the dockerized version works, it seems not to be done the real docker way.
Most annoying issue: Every time apache is restarted (which happens a lot in development) the apache_annot container and as such the whole web application stops.
To continuer apache_annot have to be restarted:
docker exec -ti apache_annot /bin/bash
Then postgresql database have to be restarted:
/etc/init.d/postgresql start
And cd into /var/www/annot/ to execute django development specific python code like:
python3 manage.py makemigrations.
It is nearly not possible to do development with this solution.
I can not be the only one who like to use a dockerize django apache developer environment. What do I do wrong?
Is there a way to run apache_annot so that the apache daemon can be rebooted without shouting down the apache_annot docker container?