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". <pre> ❯ 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 </pre> We need to show a user friendly error.
Created from redmine issue http://projects.theforeman.org/issues/9752
Note that the original reproducer case is no longer valid as we're checking in the code now for duplicate container names. Here are some potential reproducer cases that might work: - Try to create a container with name length greater than max - Try to create a container with invalid options such as an invalid port - Try to create a while not having enough disk space - Try to create a container while docker is stopped
*** Bug 1243394 has been marked as a duplicate of this bug. ***
Upstream bug component is Container Management
This bug makes determining configuration errors VERY difficult, for example see this related bug: https://bugzilla.redhat.com/show_bug.cgi?id=1315276
Here's a good test: hammer -u admin -p changeme docker container create --name crafty_ruting$RANDOM --repository-name "THISREPODOESNTEXISTHAHAHAHAHHAHAHAHAHAHA" --tag latest --compute-resource docker --command "bash" This will return: Could not create the container: undefined method `save' for nil:NilClass Should probably be something like "Could not find docker repo".
*** Bug 1318641 has been marked as a duplicate of this bug. ***
Another scenario where the error is not being properly raised to the user is in https://bugzilla.redhat.com/show_bug.cgi?id=1318641#c14. Scenario: user has docker compute resource on a remote host; however, that host does not have the bootstrap rpm installed.
Another scenario where the error is not being properly raised to the user is in https://bugzilla.redhat.com/show_bug.cgi?id=1319752 Scenario: user has specified an invalid image name during container creation
*** Bug 1319752 has been marked as a duplicate of this bug. ***
*** Bug 1330570 has been marked as a duplicate of this bug. ***
Another scenario where the error is not properly raised to the user is in bug 1330570. Scenario: user specified custom Memory size without a unit.
Seems like some of these errors have been fixed already in newer versions of foreman_docker, probably because fog returns these errors properly now. I'll update this comment with results for all of these operations Creating 2 containers with the "same name" throws the error - ' Conflict. The name "noob" is already in use by container f1cc756a3bc6. You have to remove (or rename) that container to be able to reuse that name. ' now. Creating container with custom memory size without unit: Creating container with invalid image name during creation: Creating container when bootstrap rpm has not been installed in docker host yet:
Creating container with name longer than limit: "Data too long for column 'name'" which I guess is understandable enough Creating a container with less than 4MB memory: "Minimum memory limit allowed is 4MB" - good enough Creating container with custom memory size without unit (5000000): works, it defaults to bytes. Creating a container with invalid image name (adsjkklkx): does not work, 'undefined method save for nil class'. this one has to be fixed. Creating container when Docker daemon is stopped: does not work, 'undefined method save for nil class'. this one has to be fixed.
Now under review at https://github.com/theforeman/foreman-docker/pull/165
Moving to POST since upstream bug http://projects.theforeman.org/issues/9752 has been closed
FailedQA. @satellite-6.2.0-17.0.el7sat.noarch Still errors are not properly reported, UI fails I tried to set Container Memory: 512 UI: (x) Oops, we're sorry but something went wrong undefined method `full_messages' for #<Array:0x007f138df24548> vs. journalctl -feu docker: ---------------------- Jun 28 13:01:39 <docker_host> forward-journal[13456]: time="2016-06-28T13:01:39.529117054+02:00" level=error msg="Handler for POST /v1.16/containers/create?name=busybox_cv2 returned error: Minimum memory limit allowed is 4MB" Jun 28 13:01:39 <docker_host> forward-journal[13456]: time="2016-06-28T13:01:39.529153302+02:00" level=error msg="Handler for POST /v1.16/containers/create returned error: Minimum memory limit allowed is 4MB" >>> the error message "Minimum memory limit allowed is 4MB" should propagated to the Satellite UI
Failed with tfm-rubygem-foreman_docker-2.0.1.10-2.el7sat.noarch ...app/models/service/containers.rb: 52: def pull_image(container) 53: success = container.compute_resource. < typo? (dot at the end)
def pull_image(container) success = container.compute_resource. create_image(:fromImage => container.repository_pull_url) errors << container.compute_resource.errors[:base] unless success end not typo, now it makes sense it's only wrapped on another line
VERIFIED. @satellite-6.2.0-19.1.el7sat.noarch tfm-rubygem-foreman_docker-2.0.1.11-1.el7sat.noarch Tried various container misconfigs to reproduce errors: UI: (x) Error: Error creating communicating with Docker. Check the Satellite logs: Conflict. The name "/centos" is already in use by container <HASH>... (x) Error: Error creating communicating with Docker. Check the Satellite logs: Minimum memory limit allowed is 4MB (x) Error: Error creating communicating with Docker. Check the Satellite logs: Requested CPUs are not available - requested 89278939793, available: 0-3. (x) Error: Error creating communicating with Docker. Check the Satellite logs: No such image: <SAT_FQDN>:5000/default_organization-library-docker_view-docker-fedora:24 ,Error creating communicating with Docker. Check the Satellite logs: No such image: <SAT_FQDN>:5000/default_organization-library-docker_view-docker-fedora:24 ,Error creating communicating with Docker. Check the Satellite logs: No such image: <SAT_FQDN>:5000/default_organization-library-docker_view-docker-fedora:24 ,Error creating communicating with Docker. Check the Satellite logs: No such image: <SAT_FQDN>:5000/default_organization-library-docker_view-docker-fedora:24 CLI: Could not create the container: Error creating communicating with Docker. Check the Satellite logs: Conflict. The name "/centos" is already in use by container <HASH>. You have to remove (or rename) that container to be able to reuse that name. Could not create the container: Error creating communicating with Docker. Check the Satellite logs: Minimum memory limit allowed is 4MB Could not create the container: Error creating communicating with Docker. Check the Satellite logs: Requested CPUs are not available - requested 89278939793, available: 0-3. >>> reported errors are no more opaque (undefined method `full_messages')
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2016:1501