2020년 3월 27일 금요일

Push Docker Image to GCR from WSL

shlee@DESKTOP-FEERFQV:~$ docker images
REPOSITORY                                       TAG                 IMAGE ID            CREATED             SIZE
asia.gcr.io/sunlit-theory-262204/config-server   latest              f9559cb4a95e        25 hours ago        135MB
test/configserver                                latest              f9559cb4a95e        25 hours ago        135MB
openjdk                                          8-jdk-alpine        a3562aa0b991        10 months ago       105MB
hello-world                                      latest              fce289e99eb9        15 months ago       1.84kB

shlee@DESKTOP-FEERFQV:~$ docker push asia.gcr.io/sunlit-theory-262204/config-server
WARNING: Could not open the configuration file: [/home/shlee/.config/gcloud/configurations/config_default].
ERROR: (gcloud.auth.docker-helper) You do not currently have an active account selected.
Please run:

  $ gcloud auth login

to obtain new credentials, or if you have already logged in with a
different account:

  $ gcloud config set account ACCOUNT

to select an already authenticated account to use.
The push refers to repository [asia.gcr.io/sunlit-theory-262204/config-server]
9bb9d4296990: Preparing
ceaf9e1ebef5: Preparing
9b9b7f3d56a0: Preparing
f1b5933fe4b5: Preparing
unauthorized: You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication
shlee@DESKTOP-FEERFQV:~$ gcloud auth login
Go to the following link in your browser:

    https://accounts.google.com/o/oauth2/auth?code_challenge=VHaWsnL6HYckYTK5KVqT9h2IW8kjR8sGWUy4x_-IqTw&prompt=select_account&code_challenge_method=S256&access_type=offline&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&client_id=32555940559.apps.googleusercontent.com&scope=openid+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fappengine.admin+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcompute+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Faccounts.reauth


Enter verification code: <Hidden>

You are now logged in as [lshyuk@gmail.com].
Your current project is [None].  You can change this setting by running:
  $ gcloud config set project PROJECT_ID

shlee@DESKTOP-FEERFQV:~$ gcloud config set project sunlit-theory-262204
Updated property [core/project].


shlee@DESKTOP-FEERFQV:~$ docker push asia.gcr.io/sunlit-theory-262204/config-server
The push refers to repository [asia.gcr.io/sunlit-theory-262204/config-server]
9bb9d4296990: Pushed
ceaf9e1ebef5: Layer already exists
9b9b7f3d56a0: Layer already exists
f1b5933fe4b5: Layer already exists
latest: digest: sha256:5b309a37ba393e74461b10eb52c96b4dc670425b1ba546ffa27f618e607ef6d5 size: 1159




2020년 3월 22일 일요일

Install gcloud on WSL (Ubuntu)

1) Run WSL

2) Add the Cloud SDK distribution URI as a package source
$ echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] http://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
3) Install apt-transport-https
$ sudo apt-get install apt-transport-https ca-certificates gnupg

4) Import the Google Cloud Platform public key
$ curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -

5) Update the package list and install the Cloud SDK
$ sudo apt-get update && sudo apt-get install google-cloud-sdk

6) Install Additional Component
$ sudo apt-get install google-cloud-sdk-app-engine-java

7) Start gcloud
$ gcloud init

2020년 3월 20일 금요일

docker-compose error (Unable to enable NAT rule)

$ docker-compose up -d
Creating network "chapter04_default" with the default driver
ERROR: Failed to Setup IP tables: Unable to enable NAT rule:  (iptables failed: iptables --wait -t nat -I POSTROUTING -s 172.21.0.0/16 ! -o br-8cbf06e4b2c9 -j MASQUERADE: iptables: No chain/target/match by that name.
 (exit status 1))

[Fix]
$ sudo vi /etc/docker/daemon.json
{
    "iptables":false
}

and then..

restart dockerd

2020년 3월 17일 화요일

Setting or change WSL root password

1. Open PowerShell Console
2. Comand
PS C:\Users\holyx> wsl -u root
root@LAPTOP-EEH80F78:/mnt/c/Users/holyx#
root@LAPTOP-EEH80F78:/mnt/c/Users/holyx# passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

2020년 3월 16일 월요일

Google Cloud SDK 설치


download & install : https://cloud.google.com/sdk/docs/quickstart-windows
Set Seoul Region / Zone : asia-northeast3-a

install jdk8 on Ubuntu

$ sudo apt install openjdk-8-jdk
$ java -version

Install for Ubuntu 18.04 LTS on Windows10 ( WLS )

1. 관리자 권한으로 PowerShell 실행
2. Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux 실행
3. https://www.microsoft.com/ko-kr/p/ubuntu-1804-lts/9n9tngvndl3q?rtc=1&activetab=pivot:overviewtab
4. Download & Install
5. Launch & Create Account / Password

2020년 3월 15일 일요일

Install Springboot CLI on Ubuntu

0. PreRequisite
 $ sudo apt install unzip
 $ sudo apt install zip

1. Install SDKMAN

$ curl -s https://get.sdkman.io | bash
$ source ~/.bashrc

2. Install SpringBoot
$ sdk install springboot
$ spring version

$ spring init \
     --boot-version=2.1.0.RC1  \
     --build=gradle \
     --java-version=1.8 \
     --packaging=jar \
     --name=product-service  \
     --package-name=se.magnus.microservices.core.product \
     --groupId=se.magnus.microservices.core.product \
     --dependencies=actuator,webflux  \
     --version=1.0.0-SNAPSHOT \
     product-service

2020년 3월 14일 토요일

fix for VirtualBox Shared Folder fs type error

$ sudo mount -t vboxsf share /mnt/share
mount: /mnt/share: wrong fs type, bad option, bad superblock on share, missing codepage or helper program, or other error.

$ sudo apt-get install virtualbox-guest-utils

$ sudo mount -t vboxsf share /mnt/share

2020년 1월 4일 토요일

Starting Vue web pack Project

* Prerequisite : install node.js

$ npm install vue-cli -global  // install vue client
$ mkdir test-vue-project
$ vue init webpack-simple

$ npm install
$ npm run dev

$ vi index.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.css">
    <link href="https://fonts.googleapis.com/css?family=Ubuntu" rel="stylesheet">
    <title>Basic vue index.html</title>
  </head>
  <body>
    <div id="app"></div>
    <script src="/dist/build.js"></script>
  </body>
</html>