ScottGeek Tech https://scottgeek.technology On a Mission to Civilize Sat, 24 Oct 2020 15:09:37 +0000 en-US hourly 1 https://wordpress.org/?v=5.5.1 https://scottgeek.technology/wp-content/uploads/Site-Media/Images/wordpress-logo-cseGR1.png ScottGeek Tech https://scottgeek.technology 32 32 Test a Cloud https://scottgeek.technology/test-a-cloud/ https://scottgeek.technology/test-a-cloud/#respond Sat, 24 Oct 2020 14:56:11 +0000 https://scottgeek.technology/?p=5244 just testing a cloud tage

The post Test a Cloud first appeared on ScottGeek Tech.

]]>

just testing a cloud tage

The post Test a Cloud first appeared on ScottGeek Tech.

]]>
https://scottgeek.technology/test-a-cloud/feed/ 0
DB2 SQL Update on Joined Tables https://scottgeek.technology/db2-sql-update-on-joined-tables/ https://scottgeek.technology/db2-sql-update-on-joined-tables/#respond Thu, 22 Oct 2020 14:22:49 +0000 https://scottgeek.technology/?p=5240 From time to time I have to deal with my least favorite subjects like DB2. While DB2 has a functional SQL, it’s dated and has not really kept up with SQL language improvements over the years. But it is all that I have to flow data from the IBM AS400 to the outside world (** it could be worst… like dealing with old COBOL programs). So  lets talk about updating column values that involve more that one table. Yeah, joined tables that have to have one or more columns updated.  Why would one need to do this? From time to time one needs to collect batches of rows from more than one table. And in the process of collecting batches one needs to update a “status” and/or date time stamp column to indicate the row was collected. It’s a common pattern in system integrations. When only one table is involved, it’s a simple matter. But when the data collected involves joined tables, then matters get complicated. Getting right to it, here’s the general form: Update <Table1> SET <StatusColumn> = 1 Where (Select DISTINCT <Table1>.ColumnA, <Table1>.ColumnB, <Table1>.ColumnC From <Table1> <Tabel2> Where <Table1>.ColumnA = <Table2>.ColumnA1 AND <Table1>.ColumnB = <Table2>.ColumnB1 AND <Table1>.ColumnC = <Table2>.ColumnC1 ) The two tables, in our example, have three columns we are Joining on… note this is an implicit join where the actual Join statement is not used. This update statement is a normal way to handle updating a column with a join select in the where. But this goes off the rails when it comes to DB2. Meaning it does not work. So how does one fix this?   Update <Table1>  SET <StatusColumn> = 1 Where (ColumnA, ColumnB, ColumnB) IN (Select DISTINCT <Table1>.ColumnA, <Table1>.ColumnB, <Table1>.ColumnC From <Table1> <Tabel2> Where <Table1>.ColumnA = <Table2>.ColumnA1 AND <Table1>.ColumnB = <Table2>.ColumnB1 AND <Table1>.ColumnC = <Table2>.ColumnC1 ) One adds to the Update Where clause a set of columns whose values are IN the Select of the joined tables. Like I said matters get a bit complicated for Joined tables. So what happens in the first type of Update in DB2? It does execute, but it updates all rows in the table to the Set value. This happens because, why the Join Select does execute, there’s nothing in DB2 that allows it to be an implicit part of the Update’s Where clause. Yeah, got to love that! What is one really saying there? The Where clause of the Update, in DB2, does not allow one to do just a Select… like other SQL implementations. It’s a hidden flaw, because while it looks to execute without an error, it simply does not do the intent. Therefore, one has to explicitly make sure that the Rows selected in the Where clause are part of the Update. Hence, the (columns) IN. Yes, as I mentioned, DB2 SQL not amongst my favorite languages to deal with. ~SG

The post DB2 SQL Update on Joined Tables first appeared on ScottGeek Tech.

]]>
From time to time I have to deal with my least favorite subjects like DB2. While DB2 has a functional SQL, it’s dated and has not really kept up with SQL language improvements over the years. But it is all that I have to flow data from the IBM AS400 to the outside world (** it could be worst… like dealing with old COBOL programs).

So  lets talk about updating column values that involve more that one table. Yeah, joined tables that have to have one or more columns updated.  Why would one need to do this? From time to time one needs to collect batches of rows from more than one table. And in the process of collecting batches one needs to update a “status” and/or date time stamp column to indicate the row was collected. It’s a common pattern in system integrations. When only one table is involved, it’s a simple matter. But when the data collected involves joined tables, then matters get complicated.

Getting right to it, here’s the general form:

Update <Table1>
 SET <StatusColumn> = 1 Where
  (Select DISTINCT
    <Table1>.ColumnA,
    <Table1>.ColumnB,
    <Table1>.ColumnC
    From <Table1> <Tabel2>
    Where
     <Table1>.ColumnA = <Table2>.ColumnA1 AND
     <Table1>.ColumnB = <Table2>.ColumnB1 AND
     <Table1>.ColumnC = <Table2>.ColumnC1
   )

The two tables, in our example, have three columns we are Joining on… note this is an implicit join where the actual Join statement is not used.

This update statement is a normal way to handle updating a column with a join select in the where. But this goes off the rails when it comes to DB2. Meaning it does not work. So how does one fix this?

 

Update <Table1> 
 SET <StatusColumn> = 1 Where 
  (ColumnA, ColumnB, ColumnB) IN 
   (Select DISTINCT 
     <Table1>.ColumnA, 
     <Table1>.ColumnB, 
     <Table1>.ColumnC 
     From <Table1> <Tabel2> 
     Where 
      <Table1>.ColumnA = <Table2>.ColumnA1 AND
      <Table1>.ColumnB = <Table2>.ColumnB1 AND 
      <Table1>.ColumnC = <Table2>.ColumnC1
    )

One adds to the Update Where clause a set of columns whose values are IN the Select of the joined tables. Like I said matters get a bit complicated for Joined tables.

So what happens in the first type of Update in DB2? It does execute, but it updates all rows in the table to the Set value. This happens because, why the Join Select does execute, there’s nothing in DB2 that allows it to be an implicit part of the Update’s Where clause. Yeah, got to love that! What is one really saying there?

The Where clause of the Update, in DB2, does not allow one to do just a Select… like other SQL implementations. It’s a hidden flaw, because while it looks to execute without an error, it simply does not do the intent. Therefore, one has to explicitly make sure that the Rows selected in the Where clause are part of the Update. Hence, the (columns) IN.

Yes, as I mentioned, DB2 SQL not amongst my favorite languages to deal with.

~SG

The post DB2 SQL Update on Joined Tables first appeared on ScottGeek Tech.

]]>
https://scottgeek.technology/db2-sql-update-on-joined-tables/feed/ 0
Backing up your WSL Distro and Copying it to another PC https://scottgeek.technology/backing-up-your-wsl-distro-and-copying-it-to-another-pc/ https://scottgeek.technology/backing-up-your-wsl-distro-and-copying-it-to-another-pc/#respond Sat, 17 Oct 2020 19:11:56 +0000 https://scottgeek.technology/?p=5219 In our last article we talked about Moving an install WSL Distro from it awful install folder to another drive and path. So let’s make a back up of that distro, and then install it on a different PC. Using our new favorite tool LxRunOffline let’s make back up of a distro on our PC. However, as one starts down the path of using LxRunOffline, there is a slight issue when it comes to WSL2 Distros: lxrunoffline export -n openSUSE-Leap-15-1 -f suse.tar.gz [ERROR] The action/argument “export” doesn’t support WSL2. Ok, not a huge problem… this article just got longer…. LxRunOffline export will work for WSL 1 type Distros… So let’s do an example of both using LxRunOffline and WSL utilities. For WSL 1 type Distros: LxRunOffline has a command called List- from a Powershell window my list looks like this LxRunOffline.exe list fedoraremix docker-desktop Debian Ubuntu-18.04 Ubuntu openSUSE-Leap-15-1 docker-desktop-data WLinux Ubuntu-20.04 kali-linux Now the LX tool has a command to do a backup. This collects the distro into a Linux tar file (in Linux terms a compressed tape file). LxRunOffline export –n <NameOfDistro> –f <pathAndNameOfExportFile> That’s the general format of the export. Now before one goes about exported a Distro – I would really do a WSL –shutdown Why? I think it’s best not to have any Distro’s running when you are trying to export them. It’s not a 100% required, but it is a good practice. For WSL 2 type Distros: Still do the WSL –shutdown. Now we use the WSL command to backup the Distro. Like the LX tool, WSL has basically the same set of commands. Get a list of Distros with: wsl --list Windows Subsystem for Linux Distributions: Ubuntu-20.04 (Default) fedoraremix docker-desktop Debian Ubuntu-18.04 Ubuntu openSUSE-Leap-15-1 docker-desktop-data WLinux kali-linux And the backup command for WSL: wsl --export WLinux .\PengWin.tar.gz dir Directory: D:\cse.Linux Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 10/17/2020 12:46 PM 9039769600 PengWin.tar.gz Now we have in either case a copy of our Distro that can be imported on another PC with WSL. When using WSL.exe WSL --import <Distro> <InstallLocation> <FileName> [Options] Imports the specified tar file as a new distribution. The filename can be - for standard input. Options: --version <Version> Specifies the version to use for the new distribution. The –import command  Allows one to name the Distro, install to a location, from a filename. The options here, –version allows one to change the WSL version while it’s being imported. Now LXRunOffline is a little different: lxrunoffline install Options: -n arg Name of the distribution -d arg The directory to install the distribution into. -f arg The tar file containing the root filesystem of the distribution to be installed. If a file of the same name with a .xml extension exists and "-c" isn't specified, that file will be imported as a config file. -r arg The directory in the tar file to extract. This argument is optional. -c arg The config file to use. This argument is optional. -v arg (=2) The version of filesystem to use, latest available one if not specified. -s Create a shortcut for this distribution on Desktop. As we see the install command has a few more options beyond Name, Directory, and tar filename. Happy WSL’ing, Prev Article: Moving your installed WSL Linux Distro Go Back to Index of WSL articles ~SG

The post Backing up your WSL Distro and Copying it to another PC first appeared on ScottGeek Tech.

]]>
In our last article we talked about Moving an install WSL Distro from it awful install folder to another drive and path. So let’s make a back up of that distro, and then install it on a different PC.

Using our new favorite tool LxRunOffline let’s make back up of a distro on our PC.

However, as one starts down the path of using LxRunOffline, there is a slight issue when it comes to WSL2 Distros:

lxrunoffline export -n openSUSE-Leap-15-1 -f suse.tar.gz
[ERROR] The action/argument “export” doesn’t support WSL2.

Ok, not a huge problem… this article just got longer…. LxRunOffline export will work for WSL 1 type Distros… So let’s do an example of both using LxRunOffline and WSL utilities.

For WSL 1 type Distros:

LxRunOffline has a command called List- from a Powershell window my list looks like this

LxRunOffline.exe list

fedoraremix
docker-desktop
Debian
Ubuntu-18.04
Ubuntu
openSUSE-Leap-15-1
docker-desktop-data
WLinux
Ubuntu-20.04
kali-linux

Now the LX tool has a command to do a backup. This collects the distro into a Linux tar file (in Linux terms a compressed tape file).

LxRunOffline export n <NameOfDistro> –f <pathAndNameOfExportFile>

That’s the general format of the export.

Now before one goes about exported a Distro – I would really do a WSL –shutdown Why? I think it’s best not to have any Distro’s running when you are trying to export them. It’s not a 100% required, but it is a good practice.

For WSL 2 type Distros:

Still do the WSL –shutdown.

Now we use the WSL command to backup the Distro. Like the LX tool, WSL has basically the same set of commands.
Get a list of Distros with:

wsl --list
Windows Subsystem for Linux Distributions:
Ubuntu-20.04 (Default)
fedoraremix
docker-desktop
Debian
Ubuntu-18.04
Ubuntu
openSUSE-Leap-15-1
docker-desktop-data
WLinux
kali-linux

And the backup command for WSL:

wsl --export WLinux .\PengWin.tar.gz

dir

    Directory: D:\cse.Linux

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---          10/17/2020 12:46 PM     9039769600 PengWin.tar.gz

Now we have in either case a copy of our Distro that can be imported on another PC with WSL.

When using WSL.exe

WSL

--import <Distro> <InstallLocation> <FileName> [Options]
        Imports the specified tar file as a new distribution.
        The filename can be - for standard input.

        Options:
            --version <Version>
                Specifies the version to use for the new distribution.

The –import command  Allows one to name the Distro, install to a location, from a filename. The options here, –version allows one to change the WSL version while it’s being imported.

Now LXRunOffline is a little different:

lxrunoffline install

Options:
  -n arg                Name of the distribution
  -d arg                The directory to install the distribution into.
  -f arg                The tar file containing the root filesystem of the
                        distribution to be installed. If a file of the same
                        name with a .xml extension exists and "-c" isn't
                        specified, that file will be imported as a config file.
  -r arg                The directory in the tar file to extract. This argument
                        is optional.
  -c arg                The config file to use. This argument is optional.
  -v arg (=2)           The version of filesystem to use, latest available one
                        if not specified.
  -s                    Create a shortcut for this distribution on Desktop.


As we see the install command has a few more options beyond Name, Directory, and tar filename.

Happy WSL’ing,

Prev Article: Moving your installed WSL Linux Distro

Go Back to Index of WSL articles

~SG

The post Backing up your WSL Distro and Copying it to another PC first appeared on ScottGeek Tech.

]]>
https://scottgeek.technology/backing-up-your-wsl-distro-and-copying-it-to-another-pc/feed/ 0
Moving your installed WSL Linux Distro https://scottgeek.technology/moving-your-installed-wsl-linux-distro/ https://scottgeek.technology/moving-your-installed-wsl-linux-distro/#comments Thu, 15 Oct 2020 16:00:24 +0000 https://scottgeek.technology/?p=5212 Why start this series with moving Distro’s around and not just about installing? Simple, The distro’s tend to default their install on the C: drive in the login user App Data space (don’t even get me started on over loading c:\users\<YourUserName>). So what’s the problem with c:\users\<YourUserName>\AppData\Local?  where do I begin… protected? hidden? Filling up your c: drive… pick one. But the most annoying one when it comes to Windows WSL distros… the install places these in the package folder. So c:\users\<YourUserName>\AppData\Local\Packages, and it does it in a way that usually involves a GUID like naming… Get the picture? Ok, enough harping on it… Let’s get to moving things about. You start with getting the most handy little utility called LxRunOffline. You can go to their GitHub page: Lots of mucking about with install verbiage (that’s a bit on the side of… yeah you really don’t need to do all of that on windows 10). Just go to the release page and download the zip file already: Unzip to a favorite directory… one that is in your execute path works fine. This gives one a exe that will execute from either a command window or powershell. So let’s step through it… First go ahead and install one or more of your favorite distros for WSL. Next we move it…. ## ## We will do this in Powershell ## ## Start with choosing a place we want our distro's to live... in my case the root distro I do is D:\cseWSL\<distroName> ## ## Find your user ## D:\>whoami ## I get something like mysystem\scott ## Next for the location you wish to move the distro to... i.e. in my case d:\cseWSL\Ubuntu18 ## I'm doing my Ubuntu 18.04 ## We set some access control to that directory icacls d:\cseWSL\Ubuntu18 /grant "scott:(OI)(CI)(F)" ## Here we are setting some inheriate properties and full file access to my user ## you can lookup icacls and what those parameters are from the internet ## Finding out what the distro names are ## LxRunOffline list Ubuntu ##This is same as the WSL -l command ## You can list the current location of a distro using LxRunOffline get-dir -n Ubuntu ## The -n <distro Name> is required for the get-dir command ## For my Fedora distro I get something like this .... \AppData\Local\Packages\WhitewaterFoundryLtd.Co.FedoraRemixforWSL_kd1vv0z0vy70w\LocalState ## Now the magic part... Moving a distro LxRunOffline move -n Ubuntu -d d:\cseWSL\Ubuntu18 ## the -n and -d are required for the move command ## if the named distro exists and the directory exists, then this will move the distro over ## ## To check that everything is ok with the move ## Do another LxRunOffline get-dir -n ## and see the new location ## ## Then of course, run your distro to make sure it starts up ## LxRunOffline provides a run command LxRunOffline run -n Ubuntu ## Or start the moved distro in the normal way Seems a little much to do… but not really.  It comes down to Create a Directory destination, set some permissions, and then run a command. There we are… distros located in a Happy Place. Next up: Backing up your WSL Distro and Copying it to another PC Back to Index of WSL Articles ~SG    

The post Moving your installed WSL Linux Distro first appeared on ScottGeek Tech.

]]>
Why start this series with moving Distro’s around and not just about installing? Simple, The distro’s tend to default their install on the C: drive in the login user App Data space (don’t even get me started on over loading c:\users\<YourUserName>).

So what’s the problem with c:\users\<YourUserName>\AppData\Local?  where do I begin… protected? hidden? Filling up your c: drive… pick one. But the most annoying one when it comes to Windows WSL distros… the install places these in the package folder. So c:\users\<YourUserName>\AppData\Local\Packages, and it does it in a way that usually involves a GUID like naming… Get the picture?

Ok, enough harping on it… Let’s get to moving things about.

You start with getting the most handy little utility called LxRunOffline. You can go to their GitHub page:

Lots of mucking about with install verbiage (that’s a bit on the side of… yeah you really don’t need to do all of that on windows 10). Just go to the release page and download the zip file already:

Unzip to a favorite directory… one that is in your execute path works fine. This gives one a exe that will execute from either a command window or powershell.

So let’s step through it…

First go ahead and install one or more of your favorite distros for WSL.

Next we move it….

##
##  We will do this in Powershell
##
##  Start with choosing a place we want our distro's to live... in my case the root distro I do is D:\cseWSL\<distroName>
##

## Find your user
##
D:\>whoami

## I get something like
mysystem\scott

## Next for the location you wish to move the distro to... i.e. in my case d:\cseWSL\Ubuntu18
## I'm doing my Ubuntu 18.04 
##  We set some access control to that directory
icacls d:\cseWSL\Ubuntu18 /grant "scott:(OI)(CI)(F)"
## Here we are setting some inheriate properties and full file access to my user
## you can lookup icacls and what those parameters are from the internet

## Finding out what the distro names are
##
LxRunOffline list 

Ubuntu

##This is same as the WSL -l  command

## You can list the current location of a distro using
LxRunOffline get-dir -n Ubuntu
## The -n <distro Name> is required for the get-dir command
## For my Fedora distro I get something like this
....  \AppData\Local\Packages\WhitewaterFoundryLtd.Co.FedoraRemixforWSL_kd1vv0z0vy70w\LocalState

## Now the magic part... Moving a distro
LxRunOffline move -n Ubuntu -d d:\cseWSL\Ubuntu18
##  the -n and -d are required for the move command
##  if the named distro exists and the directory exists, then this will move the distro over
##
## To check that everything is ok with the move
## Do another LxRunOffline get-dir -n
## and see the new location
##
## Then of course, run your distro to make sure it starts up
## LxRunOffline provides a run command
LxRunOffline run -n Ubuntu

## Or start the moved distro in the normal way


 


Seems a little much to do… but not really.  It comes down to Create a Directory destination, set some permissions, and then run a command.

There we are… distros located in a Happy Place.

Next up: Backing up your WSL Distro and Copying it to another PC

Back to Index of WSL Articles

~SG

 

 

The post Moving your installed WSL Linux Distro first appeared on ScottGeek Tech.

]]>
https://scottgeek.technology/moving-your-installed-wsl-linux-distro/feed/ 1
WSL Linux on Windows 10 Series of Articles https://scottgeek.technology/wsl-linux-on-windows-10-series-of-articles/ https://scottgeek.technology/wsl-linux-on-windows-10-series-of-articles/#respond Thu, 15 Oct 2020 15:59:18 +0000 https://scottgeek.technology/?p=5210 Ok it’s time to start a series on WSL. I make no apologies when I say I’m not huge Linux fan, but I’m also not lacking when it comes to understanding how to utilize this OS in my Microsoft world. First off, I’m not a newbie when it comes to matters of Linux or Unix- I spent a number of years working on HP UX with Window-X/Motif apps I had to support (so to all the Linux Trolls… yeah whatever). So why is a “Microsoft Heavy” a.k.a. Me, ScottGeek bothering with the Linux side? Simple, over the past few years with MS moving to an inclusive approach with it’s Development tooling for cross OS apps, why wouldn’t I add Linux to my stack? Now don’t get me wrong, I’m not about to start writing code in Java or some other fork of the C language beyond C#.  But Linux as a OS to deploy apps on, Linux as an IOT host, Linux as an place to share my API’s that the non-MS folks want to use- yeah that works. So shall we begin with some topics on WSL: Moving your installed WSL Linux Distro Backing up your WSL Distro and Copying it to another PC ~SG

The post WSL Linux on Windows 10 Series of Articles first appeared on ScottGeek Tech.

]]>
Ok it’s time to start a series on WSL.

I make no apologies when I say I’m not huge Linux fan, but I’m also not lacking when it comes to understanding how to utilize this OS in my Microsoft world.

First off, I’m not a newbie when it comes to matters of Linux or Unix- I spent a number of years working on HP UX with Window-X/Motif apps I had to support (so to all the Linux Trolls… yeah whatever).

So why is a “Microsoft Heavy” a.k.a. Me, ScottGeek bothering with the Linux side? Simple, over the past few years with MS moving to an inclusive approach with it’s Development tooling for cross OS apps, why wouldn’t I add Linux to my stack? Now don’t get me wrong, I’m not about to start writing code in Java or some other fork of the C language beyond C#.  But Linux as a OS to deploy apps on, Linux as an IOT host, Linux as an place to share my API’s that the non-MS folks want to use- yeah that works.

So shall we begin with some topics on WSL:

Moving your installed WSL Linux Distro
Backing up your WSL Distro and Copying it to another PC

~SG

The post WSL Linux on Windows 10 Series of Articles first appeared on ScottGeek Tech.

]]>
https://scottgeek.technology/wsl-linux-on-windows-10-series-of-articles/feed/ 0
Follow up to Setting up SSL Certs for IIS 10 https://scottgeek.technology/follow-up-to-setting-up-ssl-certs-for-iis-10/ https://scottgeek.technology/follow-up-to-setting-up-ssl-certs-for-iis-10/#respond Thu, 15 Oct 2020 13:47:34 +0000 https://scottgeek.technology/?p=5206 As a follow up to this article from the past, I got email from a reader who gave a link to a useful SSL Checker. I’ve have used this site (and others) to inspect my SSL deployments. This is handy tool to add to your collection. Thanks for the tip Lisa! ~ScottGeek

The post Follow up to Setting up SSL Certs for IIS 10 first appeared on ScottGeek Tech.

]]>
As a follow up to this article from the past, I got email from a reader who gave a link to a useful SSL Checker.

I’ve have used this site (and others) to inspect my SSL deployments. This is handy tool to add to your collection.

Thanks for the tip Lisa!

~ScottGeek

The post Follow up to Setting up SSL Certs for IIS 10 first appeared on ScottGeek Tech.

]]>
https://scottgeek.technology/follow-up-to-setting-up-ssl-certs-for-iis-10/feed/ 0
Testing Block Editor https://scottgeek.technology/testing-block-editor/ https://scottgeek.technology/testing-block-editor/#respond Fri, 14 Aug 2020 18:46:38 +0000 https://scottgeek.technology/?p=5188 So here we go…  how do we change the font… there does not seem to be a way to do that. 😎  #this is a example docker --version ⇒More This is the next section. © 2020

The post Testing Block Editor first appeared on ScottGeek Tech.

]]>
So here we go…  how do we change the font… there does not seem to be a way to do that. 😎 

#this is a example
docker --version

More

This is the next section. © 2020

The post Testing Block Editor first appeared on ScottGeek Tech.

]]>
https://scottgeek.technology/testing-block-editor/feed/ 0
Standing up Portainer using Docker Desktop on Windows. https://scottgeek.technology/standing-up-portainer-using-docker-desktop-on-windows/ https://scottgeek.technology/standing-up-portainer-using-docker-desktop-on-windows/#respond Thu, 13 Aug 2020 19:52:11 +0000 https://scottgeek.technology/?p=5184 So as I find useful Docker tools… I’m finding that Portainer is a very useful for my running Docker Desktop… The thing of it is… like a lot of images/containers… depending on what type of images you are set to run (Windows vs. Linux), the actual running of the Portainer varies. If one is on windows images… # #First time running Portainer # #Now make sure that the directory C:\ProgramData\Portainer exist or change the second volume property (-v) below # docker run -d -p 9000:9000 --name portainer --restart always -v "\\.\pipe\docker_engine:\\.\pipe\docker_engine" -v C:\ProgramData\Portainer:C:\data portainer/portainer # # This gives one access to Portainer on Localhost:9000. In the first go around you will need set an admin user and password. Now onto the Linux version… # # Do volume if one does not exist # docker volume create portainer_data # #Now start the image # docker run -d -p 9000:9000 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer The key to doing this is to choose the type of containers before executing the RUN or PULL of the portainer image. Because you got it, if you are running Windows containers – The RUN or PULL will get you that type of image for the OS… And one must Run the container based on the type. Indeed- the volume property is different between Windows and Linux…. Be Happy with your Containers…. ~SG

The post Standing up Portainer using Docker Desktop on Windows. first appeared on ScottGeek Tech.

]]>
So as I find useful Docker tools… I’m finding that Portainer is a very useful for my running Docker Desktop…

The thing of it is… like a lot of images/containers… depending on what type of images you are set to run (Windows vs. Linux), the actual running of the Portainer varies.

If one is on windows images…

#
#First time running Portainer
#
#Now make sure that the directory C:\ProgramData\Portainer exist or change the second volume property (-v) below 
#
docker run -d -p 9000:9000 --name portainer --restart always -v "\\.\pipe\docker_engine:\\.\pipe\docker_engine" -v C:\ProgramData\Portainer:C:\data portainer/portainer
#
#

This gives one access to Portainer on Localhost:9000. In the first go around you will need set an admin user and password.

Now onto the Linux version…

#
# Do volume if one does not exist
#
docker volume create portainer_data
#
#Now start the image
#
docker run -d -p 9000:9000 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer

The key to doing this is to choose the type of containers before executing the RUN or PULL of the portainer image.

Because you got it, if you are running Windows containers – The RUN or PULL will get you that type of image for the OS… And one must Run the container based on the type. Indeed- the volume property is different between Windows and Linux….

Be Happy with your Containers….

~SG

The post Standing up Portainer using Docker Desktop on Windows. first appeared on ScottGeek Tech.

]]>
https://scottgeek.technology/standing-up-portainer-using-docker-desktop-on-windows/feed/ 0
Docker Desktop WSL 2 Ports Access Denied https://scottgeek.technology/docker-desktop-wsl-2-ports-access-denied/ https://scottgeek.technology/docker-desktop-wsl-2-ports-access-denied/#respond Wed, 12 Aug 2020 13:36:45 +0000 https://scottgeek.technology/?p=5180 As I’ve been trying to work with Linux containers and images, I ran into a problem with assigning ports to Linux containers. The Linux distro is running under WSL 2 on my Windows 10 2004… and when I set the -P x:y, Docker would fail to start the container will an error Access denied.  So after lots of internet looking… and port mangling… noon of which work… I find that the Linux distro (Ubuntu 18 something) seems to require root… so here we go… I open a bash terminal under the distro that docker is using… and do the following: sudo groupadd docker sudo usermod -aG docker $USER sudo chown root:docker /var/run/docker.sock Now the first groupadd should report that the docker group already exist… not a problem. This only means you are in the right distro… The next two commands put the docker socks code under the ownership of root. And there you go, one can assign ports in the run. ~SG

The post Docker Desktop WSL 2 Ports Access Denied first appeared on ScottGeek Tech.

]]>
As I’ve been trying to work with Linux containers and images, I ran into a problem with assigning ports to Linux containers. The Linux distro is running under WSL 2 on my Windows 10 2004… and when I set the -P x:y, Docker would fail to start the container will an error Access denied. 

So after lots of internet looking… and port mangling… noon of which work… I find that the Linux distro (Ubuntu 18 something) seems to require root… so here we go…

I open a bash terminal under the distro that docker is using… and do the following:

sudo groupadd docker

sudo usermod -aG docker $USER

sudo chown root:docker /var/run/docker.sock

Now the first groupadd should report that the docker group already exist… not a problem. This only means you are in the right distro…

The next two commands put the docker socks code under the ownership of root.

And there you go, one can assign ports in the run.

~SG

The post Docker Desktop WSL 2 Ports Access Denied first appeared on ScottGeek Tech.

]]>
https://scottgeek.technology/docker-desktop-wsl-2-ports-access-denied/feed/ 0
Docker Desktop and Windows 10 2004 https://scottgeek.technology/docker-desktop-and-windows-10-2004/ https://scottgeek.technology/docker-desktop-and-windows-10-2004/#respond Fri, 07 Aug 2020 13:50:27 +0000 https://scottgeek.technology/?p=5177 Ok as I previously talked about getting Docker up and going on a PC that really does not support the level of Hyper-V that is needed by Docker Desktop… there is a another solution. Windows 2004 update… Now I’ve been putting off the move to version 2004 because it was known to have had problems… But I finally made the move… no real problems yet. So why do this… with Windows 10 2004 one get’s WSL (the Windows Subsystem Linux). This is key to getting Docker Desktop to work without using Hyper-V! So lets do some stepping through this: First move one’s Windows to version 2004 (hours and hours and hours later) – make sure you enable – Windows Subsystem for Linux- it may or may not be turned on. Second install Docker Desktop – if WSL is installed and ready the opening installer for Docker will have a WSL 2 enable selection. Make sure you select that.  **One might also have to update a default distro to WSL 2 if you have linux distros already on your PC. One will get a warning and where to go to do that. Now when Docker Desktop finally gets loaded or running… go into Powershell and do a wsl -l -v: PS C:\ps_Home> wsl -l -v NAME STATE VERSION * Ubuntu Stopped 2 SLES-15 Stopped 2 Ubuntu-20.04 Stopped 2 Debian Stopped 2 kali-linux Stopped 1 docker-desktop-data Running 2 docker-desktop Running 2 PS C:\ps_Home> If, again, everything is ok… you should see a similar list to the one above… these are the Linux Distros. As one can see I have several. ** You can select which Distro is used in Docker, but it must be a WSL 2 version… Now one can convert version 1 (in my list that would be kali-linux) by doing a wsl command- wsl --set-version kali-linux 2 You can Enable the other Distros for Docker within the Docker Desktop app. Settings => Resources => WSL Integration. And now you are good to go. ~SG

The post Docker Desktop and Windows 10 2004 first appeared on ScottGeek Tech.

]]>
Ok as I previously talked about getting Docker up and going on a PC that really does not support the level of Hyper-V that is needed by Docker Desktop… there is a another solution. Windows 2004 update…

Now I’ve been putting off the move to version 2004 because it was known to have had problems… But I finally made the move… no real problems yet. So why do this… with Windows 10 2004 one get’s WSL (the Windows Subsystem Linux). This is key to getting Docker Desktop to work without using Hyper-V!

So lets do some stepping through this:

First move one’s Windows to version 2004 (hours and hours and hours later) – make sure you enable – Windows Subsystem for Linux- it may or may not be turned on.
Second install Docker Desktop – if WSL is installed and ready the opening installer for Docker will have a WSL 2 enable selection. Make sure you select that.
 **One might also have to update a default distro to WSL 2 if you have linux distros already on your PC. One will get a warning and where to go to do that.

Now when Docker Desktop finally gets loaded or running… go into Powershell and do a wsl -l -v:

PS C:\ps_Home> wsl -l -v
  NAME                   STATE           VERSION
* Ubuntu                 Stopped         2
  SLES-15                Stopped         2
  Ubuntu-20.04           Stopped         2
  Debian                 Stopped         2
  kali-linux             Stopped         1
  docker-desktop-data    Running         2
  docker-desktop         Running         2
PS C:\ps_Home>

If, again, everything is ok… you should see a similar list to the one above… these are the Linux Distros. As one can see I have several.
** You can select which Distro is used in Docker, but it must be a WSL 2 version… Now one can convert version 1 (in my list that would be kali-linux) by doing a wsl command-

wsl --set-version kali-linux 2

You can Enable the other Distros for Docker within the Docker Desktop app. Settings => Resources => WSL Integration.

And now you are good to go.

~SG

The post Docker Desktop and Windows 10 2004 first appeared on ScottGeek Tech.

]]>
https://scottgeek.technology/docker-desktop-and-windows-10-2004/feed/ 0