ryanwold.net

A civic-minded citizen seeking the singularity

An entry

Docker and BitcoinSV

Date: 2019-08-20
Status: draft
Tags: devops docker bitcoinsv

Updated January 18, 2021.

Docker Commands

I wanted to get Docker up and running on my Macbook so that I could start to do some development on the BitcoinSV blockchain.

There is a Dockerfile online that helps with setting up a BitcoinSV Node, currently version 1.0.6.

To get all of it working well together, I had to iron out some issues during setup.

Updating where Docker stores files

On OSX, Docker stores files on the standard hard drive, in a docker folder, something like /docker/containers...

I didn't want to fill up my hard drive with the whole bitcoinSV blockchain, so I purchased an external hard drive.

To get Docker to store its files, specifically the docker.raw file on my external hard drive, I had to select File > Preferences > Disk and browse to the external hard drive location. On my external hard drive, I created a /bsv/docker folder, which is where I browsed to, and selected.

Getting the docker container image running properly

I followed the instructions on https://github.com/mrz1836/docker-bitcoinsv, to:

  1. create a Docker volume - which is like a hard drive, to store the files
  2. create a Docker image - install BitcoinSV node on a Debian image
  3. run the Docker image - run bitcoind which downloads all blocks, or from a specific block onward - and the blocks are indexed

Starting the Container

The command to list Docker containers is:

docker ps -a

Once the Container is created, it is assigned a Container id. In my case, the Container ID is 83e4215d94f8. And I will be using that Container ID for the remainder of the example.

The command to start a Docker container is:

docker start 83e4215d94f8

docker logs 83e4215d94f8

The command to access the console within a running Docker Container is

docker exec -it 83e4215d94f8 /bin/bash

The command to restart the Docker Container is:

docker restart 83e4215d94f8

The command to stop the Docker Container is:

docker stop 83e4215d94f8

The command to copy a file from the Docker Container is:

docker cp 83e4215d94f8:/bitcoinsv/raw_tx.bin ~/Desktop

This results in raw_tx.bin living on my ~/Desktop

Opening the raw bitcoin Tx with Ruby

This is an example of opening the raw bitcoin Tx with Ruby

rawtx1 = File.open("/users/ryan/Desktop/raw_tx.bin", 'rb') {|f| f.read}


Update August 18, 2023

If Docker doesn't start in OSX, even after clicking Reset to factory defaults.

For OSX, Docker's settings file is at ~/Library/Group Containers/group.com.docker/settings.json