Is it possible to create bitcoind regtest network on Ubuntu (which itself is on Virtualbox)? I am getting into Bitcoin development and it seems that bitcoin regtest mode is perfect for testing our applications. 

I am trying to create a network, following Fred Tingey's answer but, unfortunately, it's not working. 

I need suggestions, what information can I provide?
I am trying to use docker, but I have to first create 64-bit Ubuntu machine.
Thanks
It appears that Fred Tingey's answer was mostly correct, but contained incorrect port numbers in the samples he provided. If someone were to copy and paste it all it would not have worked correctly.

I've modified his answer, it is awaiting peer review.

The use of Ubuntu, Docker and VirtualBox shouldn't affect your ability to configure regtest. 

You may have problems connecting from the host to the guest, if you do I suggest perhaps asking questions on superuser or ubuntu exchanges instead.

Hope that helps!

=== Here's the edited version:

In order to run multiple nodes in regtest mode on a single machine you will need to sandbox each node. 

In this example I have three nodes, they are named Alice, Bob and Cory. Since Bitcoin is a Peer/Mesh network, my goal is to connect each nodes so that changes made to Cory are ultimately visible to Bob (without necessarily requiring a direct connection between the two.)

Step 1: Create folders for each node.

These folders will contain our data and configs for each node. The names are not important, they can be renamed later, so you can name them "Alice", "Bob" and "Cory" for now. Remember where you create them, you will need their paths for Step 3 below.

Step 2: In each folder, create a bitcoin.conf file

In the config files Alice will be configured to connect to Cory, and Bob will be configured to connect to Alice. In addition to configuring outbound connections, this is also where we specify regtest=1 and server=1 settings.

bitcoin.conf for Alice

regtest=1
server=1
 # Alice connects to Cory
connect=localhost:18333

bitcoin.con for Bob

regtest=1
server=1
 # Bob connects to Alice
connect=localhost:18444

bitcoin.conf for Cory

regtest=1
server=1
 # Cory connects to nobody


Step 3: Start each node.

Note each node must have a different port number since only one node can bind to a port number at any time.


Alice on port 18444
Bob on port 18555
Cory on port 18333


You can choose your own port numbers of course, just be careful not to use a port number that is already in use by something else.

The command-line options will tell bitcoin what port number to use, where to store data, and where to find its config file:

Cory:

"C:\Program Files\Bitcoin\bitcoin-qt.exe" -conf="C:\Cory\bitcoin.conf" -datadir="C:\Cory" -port=18333 -rpcport=8333

Bob:

"C:\Program Files\Bitcoin\bitcoin-qt.exe" -conf="C:\Bob\bitcoin.conf" -datadir="C:\Bob" -port=18555 -rpcport=8555

Alice:

"C:\Program Files\Bitcoin\bitcoin-qt.exe" -conf="C:\Alice\bitcoin.conf" -datadir="C:\Alice" -port=18444 -rpcport=8444

This will launch three instances of the Bitcoin Client, and the folders for each node will begin to initialize with regtest data.

Step 4: Testing

You can use the Help-&gt;Debug Window-&gt;Console option to interactively execute commands on any of the nodes. For example, you can mine 101 blocks with the following bitcoin console command:

setgenerate true 101

You should (after a few seconds) then have been awarded coins.  

These mining activities result in coinbase transactions - and only the last one of 50 BTC is available to spend. Now you can send some BTC to one of the other nodes.  After a bit more mining such a transaction will be confirmed.

You can also use the console commands getpeerinfo and getinfo to check the network is set up correctly.  One of them (Core wit port=18333) should have 'sync=true' in its peerinfo output, and all nodes should have the same "block height" regardless of which node is used for mining.