Getting 400 Client Error

raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http+docker://localhost/v1.44/containers/create?name=mn.containernet1

docker.errors.APIError: 400 Client Error for http+docker://localhost/v1.44/containers/create?name=mn.containernet1: Bad Request (“cgroup-parent for systemd cgroup should be a valid slice named as “xxx.slice””)

How to resolve?

It seems like you’re facing a pretty specific Docker error related to how cgroup-parent is set up. The error is telling us that the value for cgroup-parent in your Docker configuration needs to be a valid systemd slice, formatted like xxx.slice.

Here’s how you can fix it:

First, check your current Docker command or the Docker Compose file where you’re setting up your container. Look for the cgroup-parent option. It looks like it might be set incorrectly or not at all in your case. You’ll want to adjust it to a valid slice name that fits the systemd configuration on your machine. For example:

docker run --cgroup-parent=your_slice_name.slice …

Or in your Docker Compose file, it would look something like:

services:
your-service:
image: your-image
cgroup_parent: your_slice_name.slice

Make sure to replace your_slice_name with the actual slice name configured on your system. If you’re not sure what slice names are available, you might need to dive into your system’s systemd settings or ask your sysadmin.

After making these changes, try running your Docker command again. This should hopefully resolve the 400 Client Error. If you’re still stuck, it might be helpful to look up more about systemd slices or reach out on Docker forums for more detailed assistance. Good luck, and I hope this gets your container up and running smoothly!