I ran a Docker container using a very (8 lines) long list of arguments:
docker run -d -p 5000:5000 --restart=always --name registry \
-v `pwd`/auth:/auth \
-e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" \
-e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd \
-v `pwd`/certs:/certs \
-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/registry.crt \
-e REGISTRY_HTTP_TLS_KEY=/certs/registry.key \
registry:2
I confirmed this was running via docker ps
:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ff9c654bfc39 registry:2 "/bin/registry /etc/d" 2 days ago Up 13 minutes 0.0.0.0:5000->5000/tcp registry
I then stopped this container via docker stop ff9c654bfc39
. I then tried re-running the container by issuing the exact same docker run ...
(8 liner) as I did the first time:
Error response from daemon: Conflict. The name "registry" is already in use by container ff9c654bfc39. You have to delete (or rename) that container to be able to reuse that name.
So then I just tried docker restart ff9c654bfc39
and that seemed to work, but I'm not 100% sure Docker "remembered" my 8 lines of arguments from when I initially ran the container. Any ideas as to whether it is remembering? If not, what's the proper restart command to include those 8 lines?
docker restart does two things: It does the equivalent of docker stop . It sends SIGTERM to its primary process (only); if that doesn't terminate within 10 seconds, it sends SIGKILL. If the primary process still has children, they also get forcibly terminated.
By default, Docker does not apply memory limitations to individual containers. Containers can consume all available memory of the host.
A reload will not impact your containers, unlike a full daemon restart. Live restore should now be activated. You can test it out by stopping the Docker daemon.
1 Answer. Show activity on this post. Otherwise, any data written on top of an existing image layer is discarded by default when the container is removed. In the case of gitea (docker), make sure you have a local data and mysql folder, to be mounted by the Docker images.
As @gabowsky is explaining in the comments, yes, Docker will remember.
Using start
, stop
and restart
will NOT destroy the container, hence remembering everything, including data (even between reboot of the host).
What stop
does is to stop the process running inside the container. That's all.
Also, Docker store all the context, variables, etc... in an internal format. You don't have to specify command line arguments again.
To see what Docker knows about your container, you can run docker inspect
.
On the contrary, rm
will destroy everything, including none persisted data, and the container would need to be recreated again (Giving the arguments again this time).
As a final note, you should very much use names instead of SHA1 when referring containers in command line
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With