Docker - adding DNS by editing “docker” file - windows

I am using Boot2Docker on Windows and I want to edit file /etc/init.d/docker. After editing it, saving using wq command and reboot command its state is not saved. What I am doing wrong? What I want to achieve is to add configurations with DNS like in attached screen (--bip and --dns):
Is this right place to do this configuration?

That seems expected, considering Boot2Docker is based on the TinyCore distro, which only persists some files in /var/lib/boot2docker/
Typically, I modify /var/lib/boot2docker/profile in order to:
change other files
or export (set) other environment variables
That script will be persisted across TinyCore sessions, and will be executed at each restart.

Related

moving a command to a different host template using icinga director

I have Icinga2 installed with icingaweb2 on Ubuntu 19.10 and I have Icinga director Installed for the configuration which is really awesome.
I created some command and attached them to linux-agent host template.
that was a mistake cause I added more servers that don't need these new commands.
so I created a new host template called my-linux-agent as a duplicate of linux-agent and now I want to move all my custom commands to the new host template and I can't find any way to do that.
versions:
Icinga2: 2.10.5
IcingaWeb2: 2.7.1
thanks
so i couldn't find a way to move the command to a different host directly
but you can easily duplicate the command to a different host and remove the previous one using the following simple steps:
open the relevant command
click on duplicate to duplicate the command
choose the relevant host and click save
open the previous command and delete it

Docker: Oracle database 18.4.0 XE wants to configure a new database on startup

I'm trying to configure an Oracle Database container. My problem is whenever I'm trying to restart the container, the startup script wants to configure a new database and failing to do so, because there already is a database configured on the specified volume.
What can I do let the container know that I'd like to use my existing database?
The start script is the stock one that I downloaded from the Oracle GitHub:
Link
UPDATE: So apparently, the problem arises when /etc/init.d/oracle-xe-18c start returns that no database has been configured, which triggers the startup script to try and configure one.
UPDATE 2: I tried creating the db without any environment variables passed and after restarting the container, the database is up and running. This is an annoying workaround, but this is the one that seems to work. If you have other ideas, please let me know
I think that you should connect to the linux image with:
docker exec -ti containerid bash
Once there you should check manually for the following:
if $ORACLE_BASE/oradata/$ORACLE_SID exists as it does the script and if $ORACLE_BASE/admin/$ORACLE_SID/adump does not.
Another thing that you should execute manually is
/etc/init.d/oracle-xe-18c start | grep -qc "Oracle Database is not configured
UPDATE AFTER COMMENT=====
I don't have the script but you should run it with bash -x to see what is the script looking for in order to debug what's going on
What makes no sense is that you are saying that $ORACLE_BASE/admin/$ORACLE_SID/adump does not exist but if the docker deployed and you have a database running, the first time the script run it should have created this.
I think I understand the source of the problem from start to finish.
The thing I overlooked in the documentation is that the Express Edition of Oracle Database does not support a SID/PBD other than the default. However, the configuration script (seemingly /etc/init.d/oracle-xe-18c, but not surly) was only partially made with this fact in mind. Which means that if I set the ORACLE_SID and/or ORACLE_PWD environmental variables when installing, the database will be up and running, with 2 suspicious errors, when trying to copy 2 files.
mv: cannot stat '/opt/oracle/product/18c/dbhomeXE/dbs/spfileROPIDB.ora': No such file or directory
mv: cannot stat '/opt/oracle/product/18c/dbhomeXE/dbs/orapwROPIDB': No such file or directory
When stopping and restarting the docker container, I'll get an error message, because the configuration script created folder/file names according to those variables, however, the docker image is built in a way that only supports the default names, causing it to try and reconfigure a new database, but seeing that one already exists.
I hope it makes sense.

Mac Terminal shows the name of a network machine on the prompt

Once I launch the terminal app, I see a network machine name before my name, any idea how to fix it.
attached screenshot.
the name before : (colon) is a network machine name
Edit:
i went to system preferences and turned off file sharing, but it's still there (will check again after rebooting computer)
This has nothing to do with FileSharing and everything to do with the hostname that the DNS server (usually a dynamic address-ing DHCP thing) assigns you.
So what you really want to do is modify your Bash prompt.
And here is a tutorial that talks about how to do it.
You can set a custom prompt by editing your ~/.bashrc file. Just add:
export PS1="\W \$"
If you have no .bashrc file in your user home directory just create one. :D

How can I change where Vagrant looks for its virtual hard drive?

I have Vagrant set up on one of my computers. I would like to change the location of its virtual hard drive, which is currently in the default location. How can I do this without breaking Vagrant?
I have Vagrant set up with VirtualBox 4.2.
EDIT: I mean that I want to move the location of the VirtualBox machine folder, which is currently at C:\Users\Kevin\VirtualBox VMs\my_vm\box-disk1.vmdk.
Not sure if you want to change the ~/.vagrant.d or VirtualBox default machine folder.
If you want to move ~/.vagrant.d to somewhere else. You can set environment variable VAGRANT_HOME, see this https://stackoverflow.com/a/14804694/1801697
Update:
To change VirtualBox's Default Machine Folder, either do it in GUI => Prefs - General - Default Machine Folder or manually edit the ~/.VirtualBox/VirtualBox.xml
<SystemProperties defaultMachineFolder="/path/to/VirtualBox/VMs" defaultHardDiskFormat="VDI" VRDEAuthLibrary="VBoxAuth" webServiceAuthLibrary="VBoxAuth" LogHistoryCount="3"/>
you can use the command :
VBoxManage setproperty machinefolder
here the doc for more information : https://www.virtualbox.org/manual/ch08.html#vboxmanage-setproperty
You have to change your ~/.VirtualBox/VirtualBox.xml defaultMachineFolder "SystemProperty"(see other answer). As the name already suggests this seems to be a system property / environment variable.
If you then run vagrant from an already running windows console the old value is used and even your edited VirtualBox.xml is overwritten!
So make sure to close and open a new CMD-Window. after the change.

monitor folder and execute command

I'm looking for a solution for monitoring a folder for new file creation and then execute shell command upon the created file. The scenario is I have a host machine that runs a virtual machine and they share a folder. What I want is when I create or copy a new file to that shared folder on my host machine, on the VM, the system should be able to detect those changes. I have tried incron and inotify but they only work when I do the copy, create as a user in the VM. Thanks
Method 1 in this answer may help: Bash script, watch folder, execute command
Just run that script in your VM, and you should be able to detect changes made by the host.

Resources