user30732: These are the commands I'm running after building a clean ubuntu docker image with all the dependencies:
./src/bitcoin-cli -regtest &

It yields the error:
error: too few parameters (need at least command)

Next I ran:
./src/bitcoin-cli -regtest -daemon

which resulted in:
error: too few parameters (need at least command)

finally:
./src/bitcoin-cli -regtest 101 & 

yields:
error: Could not locate RPC credentials. No authentication cookie could be found, and no rpcpassword is set in the configuration file (/root/.bitcoin/bitcoin.conf)

These commands have been taken from the following resource:
https://bitcoin.org/en/developer-examples#regtest-mode
There's a question here, and a corresponding answer that provides a script to start regtest, is that a good solution?
To stop the daemon use the interface or run bitcoin-cli stop.

Next step
so I ran first:
bitcoind -regtest -daemon

and I got the output:
Bitcoin server starting

then I tried:
bitcoin-cli -regtest getinfo

which resulted in:
error: Could not locate RPC credentials. No authentication cookie could be found, and no rpcpassword is set in the configuration file (/root/.bitcoin/bitcoin.conf)

these commands also generated the same output as above:
./src/bitcoin-cli -regtest help  
./src/bitcoin-cli -regtest 101

so I've created the following file:
vim /root/.bitcoin/bitcoin.conf

it's literally just this:
rpcpassword=123

*also tried with this:
server=1
rpcuser=root
rpcpassword=password
rpcconnect=127.0.0.1
rpcport=8332

and now issued the command:
bitcoin-cli -regtest getinfo

which resulted in the following:
error: couldn't connect to server: unknown (code -1)
(make sure server is running and you are connecting to the correct RPC port)


user208: It seems you're mixing up bitcoind and bitcoin-cli.
bitcoind is the Bitcoin Core daemon. It must be running first before you can do anything. bitcoin-cli is a tool to send RPC commands to a running bitcoind instance.
From the linked documentation page:

bitcoind -regtest -daemon

No need to put a & after the command if you run with -daemon.
Once bitcoind is running, you can for example send the getinfo command using bitcoin-cli:

bitcoin-cli -regtest getinfo

Or send generate 101 to generate 101 blocks:

bitcoin-cli -regtest generate 101

To learn about other commands you can send:

bitcoin-cli -regtest help

That way you could for example learn about the ping command. To learn more about that, you can send:

bitcoin-cli -regtest help ping

You need to specify -regtest for every command, as you can have a daemon running for each network (one for mainnet, one for testnet, one for regtest), or more if you configure each to run in separate directories and network ports.
Note that bitcoin-cli is just a program that speaks JSON-RPC (which is a standardized protocol), albeit somewhat specialized for use with bitcoind. You can connect to bitcoind using any JSON-RPC client (for which libraries exist in all popular languages). To do so, you'll need to configure a username/password for connecting to bitcoind.
To explain what you are seeing:

./src/bitcoin-cli -regtest & won't work as bitcoind is not yet running, and you aren't specifying a command to send.
./src/bitcoin-cli -regtest -daemon likewise.
./src/bitcoin-cli -regtest 101 & looks almost right, except you missed the generate, so you're trying to send the non-existing command 101 to a daemon that is not yet running.


30732: <p>These are the commands I'm running after building a <a href="https://hub.docker.com/r/smatthewenglish/oakcoin/" rel="nofollow noreferrer">clean ubuntu docker image</a> with all the dependencies:</p>
<pre><code>./src/bitcoin-cli -regtest &amp;
</code></pre>
<p>It yields the error:</p>
<pre><code>error: too few parameters (need at least command)
</code></pre>
<p>Next I ran:</p>
<pre><code>./src/bitcoin-cli -regtest -daemon
</code></pre>
<p>which resulted in:</p>
<pre><code>error: too few parameters (need at least command)
</code></pre>
<p>finally:</p>
<pre><code>./src/bitcoin-cli -regtest 101 &amp; 
</code></pre>
<p>yields:</p>
<pre><code>error: Could not locate RPC credentials. No authentication cookie could be found, and no rpcpassword is set in the configuration file (/root/.bitcoin/bitcoin.conf)
</code></pre>
<p>These commands have been taken from the following resource:</p>
<p><a href="https://bitcoin.org/en/developer-examples#regtest-mode" rel="nofollow noreferrer">https://bitcoin.org/en/developer-examples#regtest-mode</a></p>
<p>There's a <a href="https://bitcoin.stackexchange.com/questions/28107/bitcoin-is-not-connected-in-regtest-mode">question here</a>, and a corresponding answer that provides a script to start regtest, is that a good solution?</p>
<p>To stop the daemon use the interface or run <code>bitcoin-cli stop</code>.</p>
<hr />
<p><strong>Next step</strong></p>
<p>so I ran first:</p>
<pre><code>bitcoind -regtest -daemon
</code></pre>
<p>and I got the output:</p>
<pre><code>Bitcoin server starting
</code></pre>
<p>then I tried:</p>
<pre><code>bitcoin-cli -regtest getinfo
</code></pre>
<p>which resulted in:</p>
<pre><code>error: Could not locate RPC credentials. No authentication cookie could be found, and no rpcpassword is set in the configuration file (/root/.bitcoin/bitcoin.conf)
</code></pre>
<p>these commands also generated the same output as above:</p>
<pre><code>./src/bitcoin-cli -regtest help  
./src/bitcoin-cli -regtest 101
</code></pre>
<p>so I've created the following file:</p>
<pre><code>vim /root/.bitcoin/bitcoin.conf
</code></pre>
<p>it's literally just this:</p>
<pre><code>rpcpassword=123
</code></pre>
<p>*also tried with this:</p>
<pre><code>server=1
rpcuser=root
rpcpassword=password
rpcconnect=127.0.0.1
rpcport=8332
</code></pre>
<p>and now issued the command:</p>
<pre><code>bitcoin-cli -regtest getinfo
</code></pre>
<p>which resulted in the following:</p>
<pre><code>error: couldn't connect to server: unknown (code -1)
(make sure server is running and you are connecting to the correct RPC port)
</code></pre>
 208: <p>It seems you're mixing up <code>bitcoind</code> and <code>bitcoin-cli</code>.</p>

<p><code>bitcoind</code> is the Bitcoin Core daemon. It must be running first before you can do anything. <code>bitcoin-cli</code> is a tool to send RPC commands to a running <code>bitcoind</code> instance.</p>

<p>From the linked documentation page:</p>

<blockquote>
  <p>bitcoind -regtest -daemon</p>
</blockquote>

<p>No need to put a <code>&amp;</code> after the command if you run with <code>-daemon</code>.</p>

<p>Once <code>bitcoind</code> is running, you can for example send the <code>getinfo</code> command using <code>bitcoin-cli</code>:</p>

<blockquote>
  <p>bitcoin-cli -regtest getinfo</p>
</blockquote>

<p>Or send <code>generate 101</code> to generate 101 blocks:</p>

<blockquote>
  <p>bitcoin-cli -regtest generate 101</p>
</blockquote>

<p>To learn about other commands you can send:</p>

<blockquote>
  <p>bitcoin-cli -regtest help</p>
</blockquote>

<p>That way you could for example learn about the <code>ping</code> command. To learn more about that, you can send:</p>

<blockquote>
  <p>bitcoin-cli -regtest help ping</p>
</blockquote>

<p>You need to specify <code>-regtest</code> for every command, as you can have a daemon running for each network (one for mainnet, one for testnet, one for regtest), or more if you configure each to run in separate directories and network ports.</p>

<p>Note that <code>bitcoin-cli</code> is just a program that speaks JSON-RPC (which is a standardized protocol), albeit somewhat specialized for use with <code>bitcoind</code>. You can connect to <code>bitcoind</code> using any JSON-RPC client (for which libraries exist in all popular languages). To do so, you'll need to <a href="https://bitcoin.org/en/developer-examples" rel="noreferrer">configure a username/password for connecting</a> to <code>bitcoind</code>.</p>

<p>To explain what you are seeing:</p>

<ul>
<li><code>./src/bitcoin-cli -regtest &amp;</code> won't work as <code>bitcoind</code> is not yet running, and you aren't specifying a command to send.</li>
<li><code>./src/bitcoin-cli -regtest -daemon</code> likewise.</li>
<li><code>./src/bitcoin-cli -regtest 101 &amp;</code> looks almost right, except you missed the <code>generate</code>, so you're trying to send the non-existing command <code>101</code> to a daemon that is not yet running.</li>
</ul>
