Restart or start best practices

I’m new with docker I have my container , and I normally use to restart ir and then I attach to it, so I can use it.

I would like to know if I can restart the container with 256mb memory and what is the difference between starting and restarting the containers?

thanks.

How do you restart your containers? Can you clarify why do you do this and if there is a concern here?
Regarding memory, I assume you are setting your memory resources when you start your container. Usually this is meant to setup an upper bound so to limit what the container can access from the host resources. Ideally this limit is setup after you profile your application resource usage. If you set your limit too low, your container will crash and it will try to restart, depending on your restart policies applied to this container.

Hello,

please let me explain this, I have a small container for python and I’m writing some python scripts in it. when I shut down the container, and “start” it back again I don’t see the scripts I created, if I “restart” the container I stopped I can see my scripts.
Thanks

Would have been nice if you would have shared your exact commands.

A container keeps state until it gets deleted. If you use docker run to create your container and just use docker stop and docker start.

Though, if you use docker-compose and do changes on your image, be sure that the container will be delted and replaced with a new instance.

If you use Docker Swarm, the container will be replaced on every start.

This is why they say a container is ephemaral/dispossable and as such should not keeps state. If you want files to be included permantently, there is no way arround writing a Dockerfile and building your own image.

hello ,
I use “docker restart cotainer_id” and then “docker attach cotainer_id”, Yesterday I wrote my Dockerfile but is not mounting the share folder.

What does the diff between docker restart vs docker start?

thanks

I will suggest you do a quick Google search to answer this question, the difference between start and restart:

I suggest you stay in scope with your initial question. If you have issues mounting a share folder, please create another post. Share your OS, docker version and exact commands and provide error message or a brief description of expected vs. observed behaviors.

I suggest you follow a guide instead of trying to figure out everything yourself. I recommend DigitalOcean. Example:

thanks for the link i will check it.