WITH DOCKERwill initialize a Docker daemon that can be used in the context of a
WITH DOCKERwe recommend (though it is not required) that you use Earthly's own Docker in Docker (dind) image:
WITH DOCKERcreates a block of code that has an
ENDkeyword. Everything that happens within this block is going to take place within our
WITH DOCKERtelling it to pull an image from Docker Hub. We can pass other flags to load in artifacts built by other targets
--loador even images defined by docker-compose
--compose. These images will be available within the context of
WITH DOCKER's docker daemon.
WITH DOCKERis running integration tests that require other services. In this case we need to set up a redis service for our tests. For this we can user a
--composeflag, Earthly will start up the services defined in the
docker-composefile for us. In this case, we built a separate image that copies in our test files and uses the command to run the tests as its
ENTRYPOINT. We can then load this image into our
WITH DOCKERcommand. Note that loading an image will not run it by default, we need to explicitly run the image after we load it.