2

I have been following a tutorial on how to deploy docker containers to AWS, which I have managed to do successfully. However now that I have modified a flask web app with my own code/logic, it never completes building the first service.

My last command:

docker-compose -f docker-compose-prod.yml up -d --build

It stars to say:

Building feapi

Then nothing happens, sometimes I get:

ERROR: SSL error: ('The write operation timed out',)

How can I debug this or at least see what is happening behind the scene, as I am not sure what is causing the error? I know docker-compose offers logs but not sure how to implement it and if its necessary.

Dmitry Rastorguev
  • 3,473
  • 4
  • 13
  • 14
  • What happens when you manually `docker build` the feapi image? What does the `Dockerfile` contain? – Matt Feb 27 '18 at 11:02

2 Answers2

6

Sometimes your context contains too many files.

When the docker build starts, it collects all the files which is in your project folder/context dir, except if you mention them in the .dockerignore. If you have GBs of files around, it can collect it for minutes and the resulting image size will be huge.

In the official docs (https://docs.docker.com/develop/develop-images/dockerfile_best-practices/) see this paragraph:

"Omitting the build context can be useful in situations where your Dockerfile does not require files to be copied into the image, and improves the build-speed, as no files are sent to the daemon."

If you are uncertain about the size of your build context, you could run a simple docker build, which prints the context size it finds. Eg.:

> docker build -t check-context:latest .
Sending build context to Docker daemon  1.086MB
...
Agnes Kis
  • 491
  • 3
  • 6
  • This could be a good answer. Please expand it. Can you give an example or citations? Can you explain why that is? Is it more the number of files or their sizes? – Uberhumus Jun 05 '20 at 20:51
0

docker-composer --build does docker build for you. If you run manually the docker build command, you will have the output of the build.

Then, docker build just runs the commmands of your Dockerfile this is up to you to put your Dockerfile commands in verbose / debug mode.

smaftoul
  • 2,375
  • 17
  • 14