How can I create/start a new container from another container?

Hi,

is it possible to execute a start container since a container ?
At this time i use a linux pipe to execute the start docker container by the host

Pierrotori

Please be so kind and rephrase your post. Maybe it is just me, but I didn’t understand what you try to achieve.

What is “start container since a container” supposed to mean?

i would to execute the command docker start container wireguard inside the domoticz container

I don’t know Domoticz. It almost sounds like it makes more sense to ask this question in the Domoticz forum.

Of course, you can map the docker.sock into the Domoticz container, but I have no idea whether it has the build-in functionality to make use of the docker.sock to start other containers.

This is not what you asked for, but there might be an alternative to what you think is the solution:
When people want to use a vpn connection from a container in other containers, they usually make the other containers use the network namespace of the vpn container. All other containers would use `–network container:${name of the vpn container or id} to use the network of the vpn container (see for further details: Docker run reference | Docker Docs). Of course the same is possible with docker compose.

the functionality docker.sock is not present in the domoticz
but for my understanding i the docker.sock is install in a container you can directly send the command docker start container wireguard ?

I’m trying to understand what you are writing and I’m not sure I managed to.

A socket is not installed. It is created by a process. In this case, the Docker daemon / Docker API. It listens to the socket so you can send instructions. If you don’t have the socket file (or a TCP socket), you can’t communicate with the daemon. Running the docker command in a container is another question. If an application in the container understands how the Docker API expects instructions, it can send them directly. If it doesn’t, you need another way, for example the docker command.

So if you have the socket file mounted into the container from the host, and you have the docker-ce-cli installed in the container, and the client has right to access the socket file, then you can run docker start and start a container on the host.

Unfotunately unless you can show us some commands that you tried or want to be able to run, we are just trying to find out what your goal is and what you mean in your questions.

i think that you give me the solution to realize the start and stop
container