EOS Contracts Nube Troubleshooting Tech Note #4: getting a Docker container working for Intro to Smart Contracts tutorial for EOSIO v1.2.0steemCreated with Sketch.

in #eos6 years ago

Getting a Docker environment running for the EOSIO Developer Portal tutorials

This is an alternative approach for running EOSIO v1.2.0 in a Docker container other than the provided Docker container referenced in the tutorials.

Notes
  1. The "pre-packaged" Docker container block.one provides with v1.2.0 had the wallet_api_plugin removed, which kills the ability of the wallet to talk to the node. You'll need to build the docker image yourself, but at least this gets things working if you're inclined to use the Docker container anyway.
  2. These instructions are right out of the other way that block.one shows how to use docker. So I'm not claiming I've invented the wheel, but it took a while to figure out that there was that other method on the site and then try it out to make sure it worked...
  3. I'm not intending to code it to 1.2.x, but things change fast, so given that this is an area of code that's actively changing, don't count on it beyond 1.2.x. I'll attempt to update it as changes are made.

The Goal

My main goal was simply to get the Docker setup to work to the point where I could work with wallets so I could continue with the tutorials.

Preconditions

===EOSIO v1.2.2===
With EOSIO v1.2.0, the wallet_api_plugin was removed from the pre-packaged Docker container and this github issue further implies that the files needed to run the wallet_api_plugin aren't even in that docker container. I've found no other explanation or fix for why that PR was created; I'd imagine it solves some other problem, but the consequence is that running the Dev Portal provided docker image mentioned in the Hello World and Introduction to Smart Contract tutorials does not provide a wallet that will talk to the nodeos service the container runs.

There are a few ways to solve this problem, but I'll offer what I think is the simplest one.

When you look at setting up a dev environment, there are a few options given. Roughly the categories are: 1) use a docker container or 2) build from source. But within the Docker category, there are also 2 options: one (the one referenced in the Intro to Smart Contracts tutorial) is a pre-packaged docker container (which is now broken (as far as the tutorial is concerned) as of 1.2.0). The other is to build the docker container yourself. Instructions here.

Now, for educational purposes, I highly recommend playing around with that entire set of instructions so you understand the tools better (I've certainly learned a lot from doing so...), but I'll give the short/extracted version here:

  • See if the docker container you already downloaded is running and stop it if it is

docker ps

docker stop <CONTAINER_ID>

  • Rather than use the provided container, which used to run nodeos, keos, and a plugin that would allow the 2 to talk, we're going to build and start a docker container that is running both in such a way that they can communicate:

git clone https://github.com/EOSIO/eos.git

docker volume create --name=nodeos-data-volume

docker volume create --name=keosd-data-volume

Replace PATH_TO_CLONED_EOS_REPO_DIR:

docker-compose -f <PATH_TO_CLONED_EOS_REPO_DIR>/Docker/docker-compose.yml up -d

Finally, to access cleos from anywhere, you can add this alias to your .bashrc / .profile script (as well as run it at the command line to make it immediately active). Remember to replace PATH_TO_CLONED_EOS_REPO:
alias cleos='docker-compose -f <PATH_TO_CLONED_EOS_REPO>/Docker/docker-compose.yml exec keosd /opt/eosio/bin/cleos -u http://nodeosd:8888 --wallet-url http://localhost:8900'

  • Finally, you can now work with the wallet. The only thing I haven't figure out yet is that the instructions in that tutorial say to create a wallet, which (if you provide no explicit name) will create the "default" wallet. It appears that that default wallet gets created automatically somewhere in this process. So you don't need to do that step, but that first step also gave you the password to that default wallet, so that's a problem...

What I've done is use an explicit wallet name, which means that every time you're accessing the wallet, you'll need to provide the name like --name test_wallet. Type cleos wallet --help to see how and where to use the --name option.

The other change in this release is that you need to add --to-console to wallet commands to see the output.

I found this post, which first walks you through a shorter version of my docker instructions above, but those instructions are a month old (at the time of this writing, and I have not verified that they work with 1.2.2) and then beautifully walks you through the wallet create process, and I've posted an updated version of the author's wallet/users creation process in script form with the 2 tweaks mentioned above for clarity. You can find that in my github repo here

Sort:  

Congratulations @mikefreemen! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 1 year!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Do not miss the last post from @steemitboard:

SteemitBoard - Witness Update
SteemitBoard to support the german speaking community meetups
Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.25
TRX 0.19
JST 0.035
BTC 92221.99
ETH 3313.28
USDT 1.00
SBD 3.85