-
Notifications
You must be signed in to change notification settings - Fork 377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to run in an existing container #34
Comments
I am not sure if I understand everything right; I am a noob with docker compose :-). Short said, you have an already existing container and want to provide an X display only occasionally? You don't want to run from image every time? I have early dropped preserving containers due to a docker issue. Maybe it got fixed in the meantime, but I don't think so. But docker has the annoying habit to create missing shared volumes as folders owned by root, even if the container is not running at all. In this example, after reboot there would be a folder Maybe you don't stumble about this issue as you share the whole folder
If you don't care about X security leaks between host and container, your solution is ok.
This is a bad idea as it allows access to X for everyone and makes your host vulnerable.
x11docker offers avoidance of X security leaks and improves container isolation. If you trust your container applications, this does not matter.
There is one possibility. x11docker offers to only create a new X server and shows what is needed to access it. Example with Xephyr:
Example with display from host:
Your container needs environment variables Do I understand right that you can subsequently add shared volumes to an already running container with docker compose? It is possible to unmount them afterwards? |
No. Docker compose is just syntactic sugar to help you start all your configured and linked containers with one command
Yes Thank you very much for the detailed answer! |
Just an afterthought: You need X only for the IDE, right? Instead of executing the IDE in the same container as the rest, you can create a new container with x11docker and share the same The following command should catch most of your IDE setup as far as I understand it:
Maybe you also need x11docker option |
This can definitely be a solution. I also need to be in the same network created by docker-compose to be able to connect to the database container. I think this can be achieved with I simplified a bit the above command just to make the IDE start
but it throws
|
Does the image contain environment variables defined with |
There is a variable
|
I've made an update that handles whitespaces in |
Now I get |
…#34) Signed-off-by: mviereck <bachbaum24@gmx.de>
ok, next try. In the pastebin log I see the image has init system |
It works! x11docker --hostdisplay --homedir ${HOME} --clipboard \
--cap-default --no-entrypoint \
-- "--cap-add=SYS_PTRACE --publish=80:8080 --network defacto_default" \
defacto \
~/soft/phpstorm/bin/phpstorm.sh The only problem is that it generates an orphan container after every execution
|
:-)
Argh! Yeah, i forgot to add I also fine-tuned the parsing of the image command. Now you can set desired working directory with:
|
Afterthought about Although recent docker versions provide option If you want to deploy your setup and always be sure |
I've made an update that checks for You would not need to set Though, you can stay with |
With latest release v4.2.0 |
I see that everything runs around
IMAGE
. You provide an image, x11docker creates a container with proper GUI configuration and runs the app inside.How about this scenario:
I have docker environment configured for my development project. A container for compiling the project, a container for database, a container for database management app. All these containers are managed with docker-compose. I would like x11docker to work like this: I specify a container and a command to start my IDE. Then x11docker will check if that container has the right configurations and will start successfully the command or will show me what I have to change in container parameters in order to fix the problem. Then I will add the required parameters in my
docker-compose.yml
, recreate the container and start my IDE via x11docker.Does this make sense?
At the moment I set up my IDE to work inside docker container by mounting my home directory,
/tmp/.X11-unix
, sharing${DISPLAY}
and starting it withdocker exec
(I sometime executexhost +
if it shows an error).I just found this solution on internet and I have no idea how it works (x11 noob).
Is my solution ok and I should continue using it or x11docker has to offer something better?
The text was updated successfully, but these errors were encountered: