1.
docker run --name some-postgres -e POSTGRES_PASSWORD = mysecretpassword -d postgres
After I stopped the container, I can not start it again using the above because the container already exists.
Right. You named it ( --name some-postgres ), so before starting a new one, the old one must be deleted, for example. docker rm -f some-postgres
So, I'm starting to use docker launch instead of docker launch. Is this a normal way to do things? Will I usually use docker starting the first time and docker starting every time?
No, this is by no means normal for dockers. Typically, docker containers should be ephemeral , which are easily discarded and restarted.
Persistence: ... I can stop and start the container and the data is saved, although I'm not sure why or how this happens ....
This is because you are reusing the same container. Remove the container and the data is gone.
Architecture: from what I read, it seems that the most suitable architecture for such an application will consist of 3 separate containers. One for the database, one for saving the database and one for the node application. Is this a good way to do this? How to make using a data container improve the situation? AFAIK my current setup works fine without it.
Yes, this is a good way to make separate containers for individual problems. This is very useful in many cases, for example, when, for example, you need to update the base postgres image without losing your data (in particular, when the data container begins to play its role).
Is there anything else I should pay attention to?
When you become familiar with the basics of dockers, you can take a look at Docker comp or similar tools to help you run multi-content applications more easily.
source share