Bug #9752

When creating a container, errors from docker are not properly reported to the user

Added by David Davis over 2 years ago. Updated 9 months ago.

Status:Closed
Priority:Normal
Assigned To:Daniel Lobato Garcia
Category:CLI
Target version:Foreman - Team Daniel - iteration 3
Difficulty: Pull request:https://github.com/theforeman/foreman-docker/pull/168, https://github.com/theforeman/foreman-docker/pull/165
Bugzilla link:1243140

Description

When I create a container with a dupe name, Docker properly responds with a 409 to let me know that it conflicts with another container. However, we're only showing "500 server error".

❯     hammer -u admin -p changeme docker container create --name crafty_turing \
      --repository-name centos --tag latest --compute-resource DockerCP --command bash
Docker container created
❯     hammer -u admin -p changeme docker container create --name crafty_turing \
      --repository-name centos --tag latest --compute-resource DockerCP --command "ping google.com" 
Could not create the container:
  Error: 500 Internal Server Error

We need to show a user friendly error.

Associated revisions

Revision ef3feba4
Added by Daniel Lobato Garcia about 1 year ago

Fixes #9752 - Pass Docker errors to controller

Revision 97cb04b2
Added by Daniel Lobato García 9 months ago

Refs #9752 - Test Docker errors are propagated

History

#1 Updated by Adam Ruzicka about 2 years ago

When I tried this today, I got back

Could not create the container:
  Name has already been taken

is this issue still valid?

#2 Updated by David Davis almost 2 years ago

Adam, yea. I fixed the duplicate name issue by adding a check in the foreman code. You can probably get around this by manually creating the container from the docker CLI. Here are some other possibilities:

  • A container with name length greater than max?
  • A container with invalid options such as an invalid port?
  • Have not enough disk space

Basically the issue here is that Docker is returning an error and we're not logging it or displaying it to the user.

#3 Updated by David Davis almost 2 years ago

  • Subject changed from When creating a container from the CLI/API, errors from docker are not properly handled to When creating a container, errors from docker are not properly reported to the user

#4 Updated by Partha Aji almost 2 years ago

  • Bugzilla link set to 1243140

#5 Updated by The Foreman Bot about 1 year ago

  • Status changed from New to Ready For Testing
  • Assigned To set to Daniel Lobato Garcia
  • Pull request https://github.com/theforeman/foreman-docker/pull/165 added

#6 Updated by Daniel Lobato Garcia about 1 year ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#7 Updated by The Foreman Bot about 1 year ago

  • Pull request https://github.com/theforeman/foreman-docker/pull/168 added

#8 Updated by Daniel Lobato Garcia 9 months ago

  • Target version set to Team Daniel - iteration 3

Also available in: Atom PDF