How to run the truffle3-frontend-example in docker

Alvaro Andres Pinzon Cortes
2 min readApr 18, 2021

Git repository: https://github.com/dougvk/truffle3-frontend-example

  1. Download the code from the Git repository
  2. Start docker and run the command
docker-compose -f docker/docker-compose.yml up -d

3. List the running containers

docker container ls --all

4. Copy the CONTAINER ID for docker_truffle3_

5. once the container starts, find the hash of the truffle3_container service and run docker attach <hash> . In this case the hash if the CONTAINER ID for docker_truffle3_

6. yarn install or npm install depending on your preference

7. change truffle.js to point to that network. this is testrpc:8545 from inside the container. To do that you will need cat as editor:

You need to paste the file’s contents with the modification and to save CTRL+D

8. truffle compile to create the json contract artifacts

9. truffle migrate to deploy the contracts onto the network

10. change the web3 provider in app/main.js to point to the testrpc server. !! this will be localhost:7000 !! In this case you do not need to do anything.

11. npm run build to compile the javascript and html assets into the build folder

12. truffle serve to serve the assets in the build folder

13. navigate to localhost:7001/index.html in your browser to see the served assets

--

--