LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-01-2020, 05:20 AM   #1
masavini
Member
 
Registered: Jun 2008
Posts: 285

Rep: Reputation: 6
'docker-like' bind mounts (without docker)


hi,
I'm actually using docker with nested bind mounts to run 2 instances of the same application with different configurations.

let's say i have an app running on the host and reading it's configuration from the directory /home/user/.config/app_config.

i can run a second instance with a different configuration running this docker command:

docker run -it \
-u user \
-v /home/user:/home/user \
-v /home/user/.config/alternative_app_config:/home/user/.config/app_config \
app_image

with this command the application running into the container reads its configuration from the host /home/user/.config/alternative_app_config directory, leaving the other configuration dir untouched.


is there a way to get this kind of behaviour without docker?
thanks!

Last edited by masavini; 12-01-2020 at 05:21 AM.
 
Old 12-01-2020, 09:18 AM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,862
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
Yes, provided you are root user. It would be much easier and flexible if your application accepted a command line option that specifies the location of the configuration file (like the --php-ini option of php).
 
Old 12-02-2020, 12:55 AM   #3
masavini
Member
 
Registered: Jun 2008
Posts: 285

Original Poster
Rep: Reputation: 6
unfortunately that's not an application of mine... how could i do the same with root privileges..?
 
Old 12-02-2020, 02:47 AM   #4
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,862
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
Now that you ask it, it would require `chroot` as well
 
Old 12-02-2020, 07:36 AM   #5
SoftSprocket
Member
 
Registered: Nov 2014
Posts: 399

Rep: Reputation: Disabled
Here's a pretty good intro to chroot https://help.ubuntu.com/community/BasicChroot

... but there might be a simpler solution, it's hard to know without some particulars. i.e. running the app as a different user from it's own home.
 
1 members found this post helpful.
  


Reply

Tags
containers



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] 32GB USB drive mounts Read Only while 4GB mounts RW CollieJim Ubuntu 10 06-13-2020 07:11 AM
Trying to revert attempted bind mounts in fstab. sr_25 Debian 1 11-08-2016 09:07 PM
LXer: OpenVZ: Mounting Host Devices/Partitions/Directories In A Container With Bind Mounts (Debian/U LXer Syndicated Linux News 0 07-21-2012 02:10 AM
2.6.24 now has read-only bind mounts, how do I use it?! sauce Linux - General 2 02-04-2008 05:10 PM
access NTFS mounts without root btaber Linux - Hardware 4 03-23-2004 04:05 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration