-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker: eb local run
tries to pass last word of docker build
STDOUT as docker image name to docker run
#53
Comments
eb local run
tries to pass last word of STDOUT as docker image nameeb local run
tries to pass last word of docker build
STDOUT as docker image name to docker run
Same issue, using Ubuntu 20.04 and EB CLI 3.19.2 (Python 3.7.2) |
Same here, anyone figure this one out? |
@rowedonalde thanks for reporting this issue. We will look into this and post any updates to this issue. |
Same issue. MacOS 10.15.7 EB CLI 3.19.2 (Python 2.7.1) |
Same issue here
|
same issue here! |
Same issue here
|
Same issue! OSX 10.15.7 (Catalina) |
Hi @rowedonalde , thanks for your patience. I have not been able to reproduce this issue. If possible can you confirm that your docker image is build successfully by running |
EB Debug log:
From my understanding, I think it's looking to the last thing on that line Please advise! |
Hi @minheekangg, If the docker image is build successfully, in debug log you can see |
It seems that you are not removing the |
Same issue As mentioned above, it does look like the time taken to run the last step (0.0s) is being added to the docker run command and this is causing the error - a quick fix would be to remove that last output maybe? UPDATE #15 writing image sha256:04c46f9cca3ee3af00a4d609643be6c32a7ee70a394c7ad70f0887ff77beebdc done
#15 DONE 0.0s
2020-12-21 13:32:02,917 (DEBUG) ebcli.core.fileoperations : Project root found at: /Users/.../projects/shiny-server/shiny-server-app
2020-12-21 13:32:02,917 (DEBUG) ebcli.core.fileoperations : Project root found at: /Users/.../projects/shiny-server/shiny-server-app
2020-12-21 13:32:02,917 (DEBUG) ebcli.core.fileoperations : Project root found at: /Users/.../projects/shiny-server/shiny-server-app
2020-12-21 13:32:02,918 (DEBUG) ebcli.core.fileoperations : Project root found at: /Users/.../projects/shiny-server/shiny-server-app
2020-12-21 13:32:02,918 (DEBUG) ebcli.core.fileoperations : Project root found at: /Users/.../projects/shiny-server/shiny-server-app
2020-12-21 13:32:02,919 (DEBUG) ebcli.lib.utils : docker run -i -t --rm -p 80:3838 --name a9d3c4a560bc2b178e773d9fb32b938ad6345f78 0.0s
Unable to find image '0.0s:latest' locally
|
@Palakpatel67 I can help recreate the issue if it would help get this resolved faster |
@ranvirm thank you! Could you provide the output of |
@Palakpatel67 Here's the log (stdout & stderr) from running |
@Palakpatel67 I was bored so I spent some time going through the logs and found the (most likely) error and possible fix. In ebcli/containers/commands.py there is a function that grabs the image_id of the newly built container from the build output text Current function:
If this function is changed to grab the 2nd to last line of build output as below then the issue should be resolved:
For reference, build output:
|
would this fix be dependent on the docker desktop version? It seems that different docker desktop versions are issuing different outputs. it seems the algorithmic solution is counter = 1 Or something like that... |
I looked at the flow of getting the image ID to use in the container run command and found that this function is the one that builds the image and returns an image id (for use in the container run function): ebcli/containers/commands.py line 49
Now there are two possible sources of error (and solutions here) - one is to alter the _grab_built_image_id() function like I said above or alter the function that runs the actual docker build command (_run_live()) so that the output is formatted correctly. The _run_live() function is called with ebcli/containers/commands.py line 277
As you can see, it then calls exec_cmd_live() which is: ebcli/lib/utils.py line 236 which is: ebcli/lib/utils.py line 199
exec_cmd() actually executes the docker build command with:
This basically runs a system command and returns the running process so that the output logs can be read. So I then tried to re-create the docker build command that generates the build logs we are seeing when running eb local run and found that this command does that:
Note the progress plain param to the docker build call - this is what produces the build output we see. Last line of output from above docker build command:
And there's the 0.0s that's being used by the AWS eb cli as the image id. So then solution 2: instead of instructing docker to produce those build logs, the docker build command could be run quietly as below:
Which will just write out the desired image id. The issue with running the docker build quietly though is that we won't see the build logs from eb local run which could bother some people so I think that solution one (edit the function that grabs the image id from the build logs) is the best fix for this issue. I like the solution @nirisarri proposed (vs my hard coded fix which could easily break again as the current one is doing) |
I tested solution 2 proposed above, changing the docker build command by altering this function: ebcli/containers/commands.py line 49 FROM
TO
Added -q to always run docker build quietly and thus only output the image id The command eb local run --port 3838 then ran successfully This fix works and should work on all platforms as I'm pretty sure that docker build quietly will always output the same (image id only) on all platforms (as documented here) |
Should I create a pull request with above solution? |
…ocal run' incorrectly parses last word of docker build stdout as image id to docker run - issue aws#53
@ranvirm @nirisarri thanks for proposing different solutions, really appreciate it. |
did we ever get a fix for this? |
I've been facing the same issue. Is there a way around this bug without modifying the source code? |
Same issue here. We have an obvious solution proposed by @ranvirm , I don't know what's taking so long to fix it. |
@Palakpatel67 Would it be possible to use |
This ishould be fixed in awsebcli version 3.19.4. |
Description
I am following the "Using the Docker Platform" tutorial, and I am encountering a bug during the "Test a container locally" step. It appears that ebcli is treating the last word of the log output as the name of a Docker image that needs to be pulled.
Steps to reproduce
Follow "Using the Docker Platform" up through the
eb local run --port 5000
step.Observed result
When I run the
eb local run --port 5000
command after following the preceding instructions in the tutorial, the image appears to build correctly, but then ultimately ends with something like this:Full output using the
--debug
flag is as follows: https://pastebin.com/GJMPKZJv. Note lines 101-107 from the paste where the script is trying to invokedocker run
with the elapsed time0.0s
as the name of a docker image:Expected result
I expect the docker image to successfully build and run locally.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
awsebcli==3.19.2
The text was updated successfully, but these errors were encountered: