Install docker
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable"sudo apt-get updatesudo apt-get install docker-ce docker-ce-cli containerd.ioTest Docker
sudo docker run hello-worldUnable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:4fe721ccc2e8dc7362278a29dc660d833570ec2682f4e4194f4ee23e415e1064
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.Run Docker by non-root user
sudo groupadd dockersudo usermod -aG docker $USERNOTE: You need to login and logout again for the new membership permission to take effect. Else, run newgrp docker.
Test without sudo
docker run hello-worldEnable Docker to start on boot
sudo systemctl enable dockerSetup Ubuntu docker to development
docker pull ubuntuStart Docker image with interactive shell
docker run -it ubuntuSetup Node 8 runtime
apt install curlcurl -sL https://deb.nodesource.com/setup_8.x -o nodesource_setup.shbash nodesource_setup.shapt-get install -y nodejsTest
node -vnpm -vSave/Commit Docker Changes
Notice the command prompt root@819af265fe19: /, where 819af265fe19 is the container id. You can check the current container id via docker ps -a (run outside of docker).
Exit docker.
exitSave the changes as ubuntu:firebase
docker commit -m 'install nodejs & npm' <CONTAINER_ID> ubuntu:firebaseStart docker again with the saved changes
docker run -it ubuntu:firebaseTest if node installation is committed.
node -vInstall Firebase
- Map docker directory with host directory:
/code/firebase/test, thus we could use IDE at host to edit the files. - Map port 9005 for firebase login
- Map port 5000 for firebase hosting
docker run -it -v /code/firebase/test:/code/firebase/test -p 9005:9005 -p 5000:5000 ubuntu:firebaseInstall Firebase
npm install -g firebase-toolsLogin
firebase loginFirebase init
cd /code/firebase/testfirebase initTest Hosting
firebase serve -o 0.0.0.0NOTE: Cannot access docker from host via localhost, thus need http://0.0.0.0:5000
Deploy
firebase deploy --only hostingNOTE: Remember to save/commit docker image after exit, else firebase setup and installation shall be lost.
References: