2020/07/15

How to install Docker on Ubuntu 18.04 and Build specific image by Dockerfile

Docker Installation
$ sudo apt install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common

$ 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 update
$ sudo apt install -y docker-ce docker-ce-cli containerd.io

Check Docker version and status
$ docker -v
$ docker info

2020/02/10

My .gitlab-ci.yml for Android Build

image: openjdk:8-jdk

variables:
  ANDROID_COMPILE_SDK: "29"
  ANDROID_BUILD_TOOLS: "29.0.2"
  ANDROID_SDK_TOOLS: "29.0.2"
 
before_script:
  - apt -q update
  - apt -q install -y wget tar unzip lib32stdc++6 lib32z1
  - wget -q -O android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
  - unzip -q android-sdk.zip
 
  - echo y | tools/bin/sdkmanager "tools"
  - echo y | tools/bin/sdkmanager "build-tools;29.0.2"
  - echo y | tools/bin/sdkmanager "platform-tools" "platforms;android-29"
  - echo y | tools/bin/sdkmanager "extras;google;m2repository"
  - echo y | tools/bin/sdkmanager "extras;android;m2repository"
 
  - export ANDROID_HOME=$PWD/
  - export PATH=$PATH:$PWD/
  - chmod +x ./gradlew

stages:
  - test
  - build

unitTests:
  stage: test
  script:
    - ./gradlew test
   
build:
  stage: build
  only:
    - master
  script:
    - ./gradlew assembleDebug
  artifacts:
    paths:
    - app/build/outputs/

2020/02/06

How to install Microsoft Azure CLI and Add Extension on Windows 10

1.Download azure-cli.msi and install
2.Open Windows PowerShell or Command Shell as administrator
3.Enter "az -h" to list command
4.Enter "az login -u 'username' -p 'password' --allow-no-subscriptions" to login Microsoft Azure
5.Enter "az extension list-available --output table" to list extension
6.Enter "az extension add --name azure-devops" to install target extension
7.Enter "az devops -h" to list command

2020/01/16

Docker Command Note

Copy folder to Docker Container
docker cp folder/. ContainerID:/home

Start/Stop all of Containers
docker start $(docker ps -a -q)
docker stop $(docker ps -a -q)

Removing All Unused Objects
docker system prune
docker system prune --volumes

Remove Containers
docker container ls -a
docker container stop ContainerID
docker container rm ContainerID
docker container ls -a --filter status=exited --filter status=created
docker container prune
docker container prune --filter "until=12h"

Remove Images
docker image ls
docker image rm ImageID
docker image prune
docker image prune -a
docker image prune -a --filter "until=12h"

Remove Volumes

docker volume ls
docker volume rm VolumeID
docker volume prune

Remove Networks

docker network ls
docker network rm NetworkID
docker network prune
docker network prune -a --filter "until=12h"

2020/01/10

How to add DNS address on Ubuntu 18.04

1.[user@docker:/#] sudo nano /etc/netplan/50-cloud-init.yaml
--------------------------------------------------------------------------------------------
# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        enp0s3:
            dhcp4: true

    version: 2
--------------------------------------------------------------------------------------------
2.Add 2 lines as below
--------------------------------------------------------------------------------------------
network:
    ethernets:
        enp0s3:
            dhcp4: true
            nameservers:
                addresses: [8.8.4.4, 8.8.8.8]
    version: 2
--------------------------------------------------------------------------------------------
3.Save and exit

How to install Docker on Ubuntu 18.04

1.[user@docker:/#] sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
2.[user@docker:/#] sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
3.[user@docker:/#] sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
4.[user@docker:/#] sudo apt update
5.[user@docker:/#] sudo apt-cache policy docker-ce
6.[user@docker:/#] sudo apt install -y docker-ce
7.[user@docker:/#] sudo systemctl status docker
8.[user@docker:/#] sudo docker -v
9.[user@docker:/#] sudo docker info

2019/10/29

How to make a Windows To Go USB disk

1.Press start menu button and type cmd to open it
2.Type "diskpart" to open disk tool
3.Type "list disk" to find your target disk
4.Type "select disk 8" to use target disk
5.Type "clean" to wipe target disk
6.Type "create partition primary" to create new partition
7.Type "format fs=ntfs quick" to quick format new partition
8.Type "assign"
9.Type "active"
10.Type "exit" to leave disk tool
11.Type "dism /apply-image /imagefile:Z:\sources\install.wim /index:1 /applydir:X:\" to install Windows in your disk
12.Type "bcdboot X:\Windows /f all /s X:\" to create bootable file in your disk