Vps Docker

sketch > vps@docker
similar: secondary-mail

Start from ubuntu 14.04

sudo apt-get update
sudo apt-get upgrade

Unable to resolve host (sudo parancsnal)

Az /etc/hostname -bol atmasoljuk a "my-machine" nevet az /etc/hosts fajlba:

127.0.0.1  mail2.XXX.xxx

innen: secondary-mail

Adduser, disable root

ubuntu 14.04 kivalaszt, belep

apt-get update; apt-get upgrade
adduser XXX
su XXX
# grant root permission
visudo 
# lama    ALL=(ALL:ALL) ALL
# disable root login via ssh
sudo vi /etc/ssh/sshd_config # PermitRootLogin no
# disable local root login
sudo passwd -l root
sudo apt-get install vim # stop this vi nonsense

innen: secondary-mail

Docker.io

wget -qO- https://get.docker.com/ | sh
sudo usermod -aG docker USERNAME

Run mongodb

# from here: https://registry.hub.docker.com/_/mongo/
sudo docker run --name some-mongo -d mongo

sudo docker ps -a

Build application

 sudo docker build -t="mycompany.myproject.`date +%Y%m%d-%H%M%S`" .
# test if everything good from shell, start with "npm start"
# sudo docker run --name mgy_`date +%Y%m%d-%H%M%S` \
#  --link some-mongo:mongo -ti mycompany.myproject /bin/bash

# check if the image is available.
sudo docker images

sudo docker run --name mgy_`date +%Y%m%d-%H%M%S` \
--link some-mongo:mongo -d -e "PORT=8083" -p 8083:8083 mycompany.myproject

Export image (without docker hub)

sudo docker save mycompany.myproject > mycompany.myproject.tar
gzip mycompany.myproject.tar

Copy to remote server

scp mycompany.myproject.tar.gz USERNAME@host.com:/home/USERNAME/

Import the image on the remote host

gunzip mycompany.myproject.tar.gz
$ docker load < mycompany.myproject.tar

Install nginx

Todo.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-NoDerivs 3.0 License