What is the difference between ‘docker run’ and ‘docker create’?

Technology CommunityCategory: DockerWhat is the difference between ‘docker run’ and ‘docker create’?
VietMX Staff asked 3 years ago

The primary difference is that using ‘docker create’ creates a container in a stopped state.

Bonus point: You can use ‘docker create’ and store an outputed container ID for later use. The best way to do it is to use ‘docker run’ with –-cidfile FILE_NAME as running it again won’t allow to overwrite the file. A good practice is to keep well ogranised directory structure: /containers/web/server1/ws.cid containers/web/server3/ws.cid