Developing CampusM using Docker Containers

Back in December, I created a mobile app for Android and Apple using Ionic with AngularJS.  I did this using my desktop running GNU/Linux.  Traditionally, when a developer works with lots of technologies through her desktop new work can eventually step on the toes of other projects or impede the new work.  When I work with Windows I have to create a VM with a full windows install plus all of the tools.  To work with Ionic I created all of the tools locally and a VM with 100GB of disk space.  Therefore, if I want a simple life I will create a vm/container per project which means lots of VMs can quickly chew through disk space.  I have just created a Docker container (not-a-vm) so that I can start learning about and developing for CampusM.  I am am the point of writing the first line of code.  The Docker container takes up a whopping 1.1GB.

The following list is pretty close to what anyone else will need to do to copy this work.

On my desktop now, I just need a web browser and editor (Vi FTW).

A list:

  • desktop:
    • docker pull fedora
    • docker run -i -t -d fedora
    • docker ps
    • docker exec -i -t 25efc7b4714d bash
  • in container:
    • as root: dnf install npm
    • as root: npm install -g
    • as root: useradd -d /home/node -c Node node
  • desktop:
    • docker commit 6a6cf3686621 fedora/campusm
    • docker stop 6a6cf3686621
    • docker run -v /usr1/home/williams/Dev/CampusM/Projects:/home/node/Projects -p 5000:5000 -i -t -d fedora/campusm
    • docker ps
    • docker exec -i -t 0c6cac5cf04fa534b26ecb9aee74740c3e2724f6980a981ceed216b5e3129301 bash
  • container
    • as node
      • cd Projects
      • aek create
      • cd projectname
      • aek start
  • desktop

CampusM working through Docker

  • desktop
    • docker exec -i -t 0c6cac5cf04fa534b26ecb9aee74740c3e2724f6980a981ceed216b5e3129301 bash
    • create RunProject in the shared directory
      • #!/bin/bash
        su - node -c "cd /home/node/Projects/$1 && aek start"
  • container
    • as root
      • cp ~node/Projects/RunProject /usr/local/bin/
      • chmod +x /usr/local/bin/RunProject
  • desktop
    • now we don’t have to go in to the container to start the project
    • docker exec -t -i 2f85e2474912 /usr/local/bin/RunProject projectname

Well done you.

About c3iq

Free(dom) software, GNU/Linux, Fish, Family
This entry was posted in app, Development, Docker, ITMS, Linux SysAdmin, Virtual Machines and tagged , , , , , , , . Bookmark the permalink.