neruve Posted February 13, 2020 Share Posted February 13, 2020 I don't know if this is possible or not. I'm not super familiar and still learning. Is there a way to run a script after creating and starting the container for the first time? My current use case is that I have an MSSQL container and I want to enable SSIS but its a seperate install. So I would like to create a script with the commands to install SSIS everytime the container is created (or updated) but it needs to only run one time on the initial startup of the container. Anyone have any suggestions? Quote Link to comment
Squid Posted February 13, 2020 Share Posted February 13, 2020 Can't do anything via unRaid itself. But, if you only have the autoupdate plugin update the app on a schedule, then you can do this https://forums.unraid.net/topic/51959-plugin-ca-application-auto-update/page/3/?tab=comments#comment-545746 Any manual updates that you do via the Docker Tab will not execute the script as described. Quote Link to comment
Roxedus Posted February 13, 2020 Share Posted February 13, 2020 There is ways. If it were a Linuxserver container, I would utilize their function created just for this kind of modification. https://blog.linuxserver.io/2019/09/14/customizing-our-containers/ Quote Link to comment
neruve Posted February 14, 2020 Author Share Posted February 14, 2020 Okay, so i'm trying to run these commands inside my sqlserver docker. https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-ssis?view=sql-server-ver15 However, I can't do anything, sudo doesn't exists, curl doesn't exist and when i try to install curl i get the following: $ apt-get install curl E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied) E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root? i'm a complete n00b here as far as things inside a container. Can anyone provide any insight? Quote Link to comment
knex666 Posted February 14, 2020 Share Posted February 14, 2020 I would use a base Image and create my own. YOu can create a docker file or you can exec it into the Container install everything and after you finished you make a commit to your own Image. Quote Link to comment
neruve Posted February 14, 2020 Author Share Posted February 14, 2020 10 minutes ago, knex666 said: I would use a base Image and create my own. YOu can create a docker file or you can exec it into the Container install everything and after you finished you make a commit to your own Image. This is a little above my head. Any other info you can provide or links on where to start? Quote Link to comment
hernandito Posted February 26, 2021 Share Posted February 26, 2021 (edited) I know this topic is old... but when investigating this, I found the solution for this IF you are using a Linuxserver docker. @Roxedus pointed to the solution above; BUT it was not quite working. In my case, I was trying to run a script to the SWAG docker. In /cache/appdata/swag folder, create a folder called "custom-cont-init.d" in that folder, create a script file, in my case, I called it install.sh. Here are the contents of this file: #!/bin/bash echo "**** Sending Update/Upgrade Commands ****" apk ugrade apk update echo "**** installing OpenSSH and MC ****" apk --update add --no-cache openssh apk --update add --no-cache mc For installing packages to your Docker, the upgrade and update commands are critical. Otherwise you will get a "package not found" error. Re-install the Docker, and the script gets executed. Check out the Dockers log page and you will see the results of the script. Amazing thing about the LSIO guys, they think of EVERYTHING.... Donate! Edited February 26, 2021 by hernandito Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.