Repository: conan-io/conan

Issue:
[bug] Docker runner does not honor custom container name
### Describe the bug

When trying to use official ConanDockerTools images with the new feature [Docker runners](https://docs.conan.io/2/reference/runners/docker.html), I wanted to use a custom container name (e.g conan_linux_gcc11), however, the current behavior uses image name instead and ignores my configuration file.

```
conan create all --version=1.0.1 -pr linux-gcc11                                                                                                                     

======== Exporting recipe to the cache ========
paho-mqtt-cpp/1.0.1: Exporting package recipe: /Users/uilian/Development/conan/conan-center-index/recipes/paho-mqtt-cpp/all/conanfile.py
paho-mqtt-cpp/1.0.1: exports: File 'conandata.yml' found. Exporting it...
paho-mqtt-cpp/1.0.1: Calling export_sources()
paho-mqtt-cpp/1.0.1: Copied 1 '.py' file: conanfile.py
paho-mqtt-cpp/1.0.1: Copied 1 '.yml' file: conandata.yml
paho-mqtt-cpp/1.0.1: Copied 1 '.patch' file: 1.0.1-0001-fix-cmake.patch
paho-mqtt-cpp/1.0.1: Exported to cache folder: /Users/uilian/.conan2/p/paho-c2a77d934f3de/e
paho-mqtt-cpp/1.0.1: Exported: paho-mqtt-cpp/1.0.1#f7c87fa70a8dc4d8274efeb500f73320 (2024-05-10 10:03:04 UTC)

======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=17
compiler.libcxx=libstdc++11
compiler.version=11
os=Linux
[conf]


Profile build:
[settings]
arch=armv8
build_type=Release
compiler=apple-clang
compiler.cppstd=17
compiler.libcxx=libc++
compiler.version=15
os=Macos
[conf]



┌───────────────────────────────┐
| Creating the docker container |
└───────────────────────────────┘

ERROR: Imposible to run the container "conanio/gcc11-ubuntu16.04:2.3.0" with image "conanio/gcc11-ubuntu16.04:2.3.0"

400 Client Error for http+docker://localhost/v1.43/containers/create?name=conanio%2Fgcc11-ubuntu16.04%3A2.3.0: Bad Request ("Invalid container name (conanio/gcc11-ubuntu16.04:2.3.0), only [a-zA-Z0-9][a-zA-Z0-9_.-] are allowed")
```


The 🐛 is because the code is passing the image name instead of the container name to Docker:

https://github.com/conan-io/conan/blob/2.3.0/conan/internal/runner/docker.py#L114

🍔 

/cc @davidsanfal 

#### Environment 

OS: OSX 14.4.1 (23E224)
Arch: Mac M1 MAX
Conan version: 2.3.0
Docker version: 25.0.4-rd
Rancher version: 1.13.1

### How to reproduce it

To reproduce this error in Mac, I need a profile file and a configuration file, plus, the docker image downloaded.

```
# ~/.conan2/profiles/linux-gcc11
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=17
compiler.libcxx=libstdc++11
compiler.version=11
os=Linux

[runner]
type=docker
cache=clean
remove=true
configfile=/Users/uilian/.conan2/runners/linux-gcc11
```

```
# ~/.conan2/runners/linux-gcc11
image: conanio/gcc11-ubuntu16.04:2.3.0
run:
    name: conan_linux_gcc11
    containerUser: conan
    privileged: False
```

Once you have these files in your Conan cache folder, you will need to run:

```
docker pull conanio/gcc11-ubuntu16.04:2.3.0
conan new cmake_lib -d name=foo -d version=0.1.0
conan create . -pr:b default -pr:h linux-gcc11
```

(I ran docker pull separated only to illustrate)


Discussion:
Asked @uilianries to fix this so that it's ready for 2.3.1 as David is away this week :)

Resolving patch:
diff --git a/conan/internal/runner/docker.py b/conan/internal/runner/docker.py
--- a/conan/internal/runner/docker.py
+++ b/conan/internal/runner/docker.py
@@ -90,7 +90,7 @@ def __init__(self, conan_api, command, host_profile, build_profile, args, raw_ar
             profile_list = set(self.args.profile_build + self.args.profile_host)
         else:
             profile_list = self.args.profile_host or self.args.profile_build
-        
+
         # Update the profile paths
         for i, raw_arg in enumerate(raw_args):
             for i, raw_profile in enumerate(profile_list):
@@ -111,7 +111,7 @@ def __init__(self, conan_api, command, host_profile, build_profile, args, raw_ar
         if not (self.dockerfile or self.image):
             raise ConanException("'dockerfile' or docker image name is needed")
         self.image = self.image or 'conan-runner-default'
-        self.name = self.configfile.image or f'conan-runner-{host_profile.runner.get("suffix", "docker")}'
+        self.name = self.configfile.run.name or f'conan-runner-{host_profile.runner.get("suffix", "docker")}'
         self.remove = str(host_profile.runner.get('remove', 'false')).lower() == 'true'
         self.cache = str(host_profile.runner.get('cache', 'clean'))
         self.container = None


Test patch:
diff --git a/conans/test/integration/command/runner_test.py b/conans/test/integration/command/runner_test.py
--- a/conans/test/integration/command/runner_test.py
+++ b/conans/test/integration/command/runner_test.py
@@ -141,7 +141,8 @@ def test_create_docker_runner_dockerfile_file_path():
     client.save({"host": profile_host, "build": profile_build})
     client.run("new cmake_lib -d name=pkg -d version=0.2")
     client.run("create . -pr:h host -pr:b build")
-    print(client.out)
+
+    assert "Container conan-runner-docker running" in client.out
     assert "Restore: pkg/0.2" in client.out
     assert "Restore: pkg/0.2:8631cf963dbbb4d7a378a64a6fd1dc57558bc2fe" in client.out
     assert "Restore: pkg/0.2:8631cf963dbbb4d7a378a64a6fd1dc57558bc2fe metadata" in client.out
@@ -249,7 +250,7 @@ def test_create_docker_runner_profile_abs_path():
     cache=copy
     remove=True
     """)
-    
+
     client.save({"host": profile_host, "build": profile_build})
     client.run("new cmake_lib -d name=pkg -d version=0.2")
     client.run(f"create . -pr:h '{os.path.join(client.current_folder, 'host')}' -pr:b '{os.path.join(client.current_folder, 'build')}'")
@@ -272,6 +273,8 @@ def test_create_docker_runner_profile_abs_path_from_configfile():
         build:
             dockerfile: {dockerfile_path("Dockerfile_test")}
             build_context: {conan_base_path()}
+        run:
+            name: my-custom-conan-runner-container
         """)
     client.save({"configfile.yaml": configfile})
 
@@ -301,11 +304,12 @@ def test_create_docker_runner_profile_abs_path_from_configfile():
     cache=copy
     remove=True
     """)
-    
+
     client.save({"host": profile_host, "build": profile_build})
     client.run("new cmake_lib -d name=pkg -d version=0.2")
     client.run(f"create . -pr:h '{os.path.join(client.current_folder, 'host')}' -pr:b '{os.path.join(client.current_folder, 'build')}'")
 
+    assert "Container my-custom-conan-runner-container running" in client.out
     assert "Restore: pkg/0.2" in client.out
     assert "Restore: pkg/0.2:8631cf963dbbb4d7a378a64a6fd1dc57558bc2fe" in client.out
     assert "Restore: pkg/0.2:8631cf963dbbb4d7a378a64a6fd1dc57558bc2fe metadata" in client.out
@@ -357,11 +361,11 @@ def test_create_docker_runner_profile_abs_path_from_configfile_with_args():
     cache=copy
     remove=True
     """)
-    
+
     client.save({"host": profile_host, "build": profile_build})
     client.run("new cmake_lib -d name=pkg -d version=0.2")
     client.run(f"create . -pr:h '{os.path.join(client.current_folder, 'host')}' -pr:b '{os.path.join(client.current_folder, 'build')}'")
-    print(client.out)
+
     assert "test/integration/command/dockerfiles/Dockerfile_args" in client.out
     assert "Restore: pkg/0.2" in client.out
     assert "Restore: pkg/0.2:8631cf963dbbb4d7a378a64a6fd1dc57558bc2fe" in client.out
@@ -434,4 +438,4 @@ def test_create_docker_runner_default_build_profile_error():
     client.save({"host_clean": profile_host})
     client.run("new cmake_lib -d name=pkg -d version=0.2")
     with pytest.raises(Exception, match="ERROR: The default build profile '/root/.conan2/profiles/default' doesn't exist.") as exception:
-        client.run("create . -pr:h host_clean")
\ No newline at end of file
+        client.run("create . -pr:h host_clean")