Newest Post
Tampilkan postingan dengan label code. Tampilkan semua postingan
Tampilkan postingan dengan label code. Tampilkan semua postingan

Kamis, 02 Mei 2019

Docker and Laradock Setup Successful Notes (MAC)(WIN)

Docker and Laradock Setup Successful Notes for MAC (tested)(8 GB RAM)
- For windows you might need extra memory more than 4 GB RAM.
My PC Test Specs :
- iMac (21.5-inch, 2017) i5 - 8GB RAM DDR4
- macOS (High Sierra) v10.13.6

Before starting with laradock, make sure you are creating 1 directory

example setup :

+ laraveldocker
+ + laradock (put laradock inside laraveldocker folder)
+ + yourproject_1
+ + yourproject_2
+ + yourproject_3
+ + yourproject_......

// register that laravel folder in docker preferences
right click docker
> Preferences
> File Sharing
> click "+" / Add
> add that folder (laraveldocker)
- - - in my dir is : /Applications/XAMPP/xamppfiles/htdocs/laravel
> Apply & Restart

// install docker
// error notes ? vm cannot be create
// make sure your memory is big enough
// # # and read this notes : https://sharezone47.blogspot.com/2019/05/docker-unable-to-create-ErrorActionPreference.html

// docker compose build (this is the most fatal things in docker)
$> docker-compose 

// docker compose up
$> docker-compose up -d nginx mysql phpmyadmin redis workspace
$> docker-compose up apache2 php-fpm mysql phpmyadmin
$> docker-compose up nginx php-fpm mariadb adminer

// restart every edit laradock
$> docker-compose restart nginx
$> docker-compose restart apache2

// shutdown all docker laradock instance
$> docker-compose down

// to stop docker // example
docker-compose stop nginx


// see running container (docker and docker-compose)
docker ps
docker-compose ps

// edit host os /etc/hosts and add IP/Hostname mapping
127.0.0.1  laravel.test
127.0.0.1  sheezy.local
127.0.0.1  nonlaravelapp.local

// sites nginx
$> cp laravel.conf.example yoursites.conf

// go inside mysql
docker-compose exec mysql bash
docker-compose exec mysql mysql -u homestead -psecret

// go inside

$> docker-compose exec workspace bash

// reference
https://sharezone47.blogspot.com/2019/05/docker-unable-to-create-ErrorActionPreference.html
# https://sudonull.com/posts/332-Laravel-Docker-Our-Successful-Experience

Rabu, 01 Mei 2019

Docker Unable to create "ErrorActionPreference" (Solved)(Windows)

Come to the New Docker, I get a new error Unable to create: The running command stopped because the preference variable "ErrorActionPreference", and here is the solution (2 solution).
First of all, don't lazy to read the error :
Unable to create: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: The computer 'AKPC-DESKTOP' could not be resolved. Make sure you typed the machine name correctly and that you have network access.
at New-MobyLinuxVM, <No file>: line 218
at <ScriptBlock>, <No file>: line 375
   at Docker.Backend.HyperV.RunScript(String action, Dictionary`2 parameters)
   at Docker.Backend.ContainerEngine.Linux.Start(Settings settings)
   at Docker.Core.Pipe.NamedPipeServer.<>c__DisplayClass8_0.<Register>b__0(Object[] parameters)
   at Docker.Core.Pipe.NamedPipeServer.RunAction(String action, Object[] parameters)
1. If you are seeing "Make sure you typed the machine name correctly and that you have network access"

Solution: you need internet. please turn on your network.

2. After That, Oops we got another error, hahaha. no need to worry.
Unable to execute Start: Unable to create: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Failed to create the virtual hard disk.

The system failed to create 'C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\MobyLinuxVM.vhdx'.
at Ensure-VHD-Path, <No file>: line 306
at New-MobyLinuxVM, <No file>: line 208
at <ScriptBlock>, <No file>: line 411    at Docker.Backend.HyperV.RunScript(String action, Dictionary`2 parameters) in C:\workspaces\stable-18.09.x\src\github.com\docker\pinata\win\src\Docker.Backend\HyperV.cs:line 195
   at Docker.Backend.HyperV.Create(Settings settings) in C:\workspaces\stable-18.09.x\src\github.com\docker\pinata\win\src\Docker.Backend\HyperV.cs:line 125
   at Docker.Backend.ContainerEngine.Linux.Start(Settings settings, String daemonOptions) in C:\workspaces\stable-18.09.x\src\github.com\docker\pinata\win\src\Docker.Backend\ContainerEngine\Linux.cs:line 117
[13:43:17.016][NamedPipeClient][Error  ] Unable to send Start: Unable to create: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Failed to create the virtual hard disk.

The system failed to create 'C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\MobyLinuxVM.vhdx'.
at Ensure-VHD-Path, <No file>: line 306
at New-MobyLinuxVM, <No file>: line 208
at <ScriptBlock>, <No file>: line 411
[13:43:17.016][Notifications  ][Error  ] Unable to create: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Failed to create the virtual hard disk.

The system failed to create 'C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\MobyLinuxVM.vhdx'.
at Ensure-VHD-Path, <No file>: line 306
at New-MobyLinuxVM, <No file>: line 208
at <ScriptBlock>, <No file>: line 411

If you are seeing 'Unable to create: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Failed to create the virtual hard disk.'

Solution :
- open Command Prompt, run as Administrator, then type this one.
MOFCOMP %SYSTEMROOT%\System32\WindowsVirtualization.V2.mof

- Then go to this folder : ( in my place The system failed to create 'C:\Users\Public\Documents\Hyper..... so in your side maybe different. ).
C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\....
You will see an administrator prompt there. (i forget what, but Windows will show you a Windows to prompt), just allowed that, so all content there can be seen public.

- Finally, run your docker like usual.

- Case Solved

More info  :
Docker not starting on windows 10 #214
Unable to create: The running command stopped because the preference variable "ErrorActionPreference" #1538
Can't run Docker for Windows after install for the first time #1177

Happy Wednesday
KG




Sabtu, 08 April 2017

Docker login Error / Stuck (SOLVED)(windows)

Oh no Docker (windows) Stuck at login , why cannot login to my docker through cmd git


Case :

Warning: failed to get default registry endpoint from daemon (error during conne ct: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.27/info: open //./pipe/docker_e ngine: The system cannot find the file specified. In the default daemon configur ation on Windows, the docker client must be run elevated to connect. This error
may also indicate that the docker daemon is not running.). Using system default:  https://index.docker.io/v1/
Login with your Docker ID to push and pull images from Docker Hub. If you don't
have a Docker ID, head over to https://hub.docker.com to create one.
> error during connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.27/auth: ope n //./pipe/docker_engine: The system cannot find the file specified. In the defa ult daemon configuration on Windows, the docker client must be run elevated to c onnect. This error may also indicate that the docker daemon is not running.
> docker login
Error: Cannot perform an interactive login from a non TTY device

Solution :

> docker-machine start default
> docker-machine env default
> @FOR /f "tokens=*" %i IN ('docker-machine.exe env --shell cmd') DO @%i
> docker login
Username: *
Password: *
Login Succeeded

More info  :
Trying to connect to Docker API for shell commands throws error

Happy Saturday
KG

Jumat, 07 April 2017

Docker for windows (BASIC guide)

What is docker ? and why docker ?
one bad day for dev is that "wait, this work in my machine"

So, to prevent that we use docker


Jumat, 24 Oktober 2014

String - character length and size - C++

Compiler online :
http://cpp.sh/

//Code to learn:
#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
   char a[5]="abc";
    cout<<sizeof(a);
    cout<<endl;

    string s;
    s=a;
    cout<<s.length();
    cout<<endl;
    cout<<s.size();
    cout<<endl;
//other output type
    cout<<"String = "<<s.size()<<endl;
    cout<<"Size of string :"<<s.size()<<endl;
    cout<<"Size of string :"<<s.length();
    return 0;
}