Skip to content
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

Autostart script/app on container startup #191

Closed
moltrabella opened this issue Jul 3, 2020 · 6 comments
Closed

Autostart script/app on container startup #191

moltrabella opened this issue Jul 3, 2020 · 6 comments

Comments

@moltrabella
Copy link

Hi there, is there any way to get a script running un container startup? i've been trying modifiyng the entrypoint or the cmd but cannot get it working. I also tried with desktop files.
My main idea es to launch a bash to call a python script for opening a browser and login automatically. I have a volume mounted with the .sh but cannot get it start. Sorry for bad english.

@fcwu
Copy link
Owner

fcwu commented Jul 4, 2020

#85

@fcwu fcwu added the duplicate label Jul 4, 2020
@fcwu fcwu closed this as completed Jul 6, 2020
@moltrabella
Copy link
Author

moltrabella commented Jul 6, 2020

Hi fcwu sorry for late testing but couldn't get it sooner. I've tried to user the OPENBOX_ARGS but no getting to work. I'm actually using docker-compose and added this as an ENV, edited the /etc/xdg/openbox/autostart file to call my sh script which calls a python one but i think i'm lacking something. this is how my compose line lookslike

  - OPENBOX_ARGS=--startup "/etc/xdg/openbox/autostart"

and this is the line i added to autostart file

/bin/bash/start.sh

Also tried to add directly in the compose file this way

   - OPENBOX_ARGS=--startup "/start.sh"

@SystemDiagnosticss
Copy link

@moltrabella Are you solve?

@moltrabella
Copy link
Author

yes i am, after playing a while the env i get it working like a charm

@SystemDiagnosticss
Copy link

SystemDiagnosticss commented Jul 17, 2020

@moltrabella Can you show your code and provide step?

@moltrabella
Copy link
Author

Sure, this is my docker-compose file

version: '3'
services:

test:
image: dorowu/ubuntu-desktop-lxde-vnc
container_name: test1
environment:
- PUID=1000
- PGID=1000
- TZ=America/Argentina/Buenos_Aires
- OPENBOX_ARGS=--startup /config/Ubuntu-VNC/start.sh
volumes:
- /var/lib/docker/volumes/Autologin_test/:/config/Ubuntu-VNC/:ro
networks:
mymacvlan66:
ipv4_address: 192.168.0.23
restart: unless-stopped

networks:
mymacvlan66:
external: true

as you can se i have a volume mounted in the container where i call my script. The trick was the "- OPENBOX_ARGS=--startup" env. Just runnning a default cointainer with that should call anything on startup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants