Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Running a script after docker creation

Featured Replies

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?

  • Author

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?

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. 

 

  • Author
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?

  • 1 year later...

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 by hernandito

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.