Docker-compose run vs docket run

I have one quastion
What is the difference between the following commands?
Docker run terraform
Docket-compose run terraform

Docker build nginx
Docker-compose build nginx

1 Like

In what regards?

The first two create and start containers based on the provided image. Additionaly docker-compose run will build the image if build: is configured to point to a Dockerfile and the image itself does not exist in the local cache.
The second two build custom images, where you have to specify the Dockerfile you created as blueprint on how the image is build.

May I suggest this excellent free self-paced docker training? It should give you solid foundation about docker concepts and how things are done in docker.

Thanks for your respond ! But my quastion is ;
Is that differrent between docker commamd and docker-compose command for run an image ?? (OR docker and docker-compose for build an image?)

no, there is no difference regarding the outcome.