### Enable and Configure SSH Server on Windows Source: https://github.com/buildpacks/pack/wiki/Remote-Windows-Docker-Desktop Install the OpenSSH server, set it to start automatically, and start the service on the remote Windows machine. ```powershell Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 ; Get-Service sshd | Set-Service -StartupType Automatic ``` ```powershell Start-Service sshd ``` -------------------------------- ### Install and Configure OpenSSH Server Source: https://github.com/buildpacks/pack/wiki/Windows-WCOW-Docker-Daemon-on-Cloud-VM Installs the OpenSSH server, sets its startup type to automatic, and starts the service. It also includes an optional step to add a public key for passwordless SSH access. ```powershell Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 ; Get-Service sshd | Set-Service -StartupType Automatic ; Start-Service sshd ``` ```powershell Read-Host "waiting for pubkey" | Out-File -Encoding ascii -Append C:\ProgramData\ssh\administrators_authorized_keys ; $acl = Get-Acl C:\ProgramData\ssh\administrators_authorized_keys ; $acl.SetSecurityDescriptorSddlForm("O:BAG:BAD:PAI(A;;FA;;;SY)(A;;FA;;;BA)") ; $acl | Set-Acl ``` -------------------------------- ### Install Docker for Windows on VM Source: https://github.com/buildpacks/pack/wiki/Windows-Docker-Daemon-on-Fusion-VM Use Administrator PowerShell on the Windows VM to install the Docker MsftProvider and the Docker package. A restart is required after installation. ```powershell Install-Module -Name DockerMsftProvider -Repository PSGallery -Force Install-Package -Name docker -ProviderName DockerMsftProvider -Force Restart-Computer -Force ``` -------------------------------- ### Install pack-cli-bin from AUR Source: https://github.com/buildpacks/pack/wiki/Arch-Linux Clones the pack-cli-bin AUR repository, builds, and installs the package using makepkg. ```shell # install pack-cli-bin cd ~ git clone https://aur.archlinux.org/pack-cli-bin.git cd pack-cli-bin makepkg -sri --noconfirm ``` -------------------------------- ### Install pack-cli from AUR Source: https://github.com/buildpacks/pack/wiki/Arch-Linux Clones the pack-cli AUR repository, builds, and installs the package using makepkg. ```shell # install pack-cli cd ~ git clone https://aur.archlinux.org/pack-cli.git cd pack-cli makepkg -sri --noconfirm ``` -------------------------------- ### Install and Configure Richgo for Go Source: https://github.com/buildpacks/pack/wiki/Windows-WCOW-Docker-Daemon-on-Cloud-VM Installs the richgo tool for enhanced Go build output and configures the default 'go' command to use richgo. It also sets the GOCMD environment variable. ```powershell go get -u github.com/kyoh86/richgo echo ' Set-Alias go -Value richgo $env:GOCMD="richgo" ' | Out-File -Append -FilePath $env:USERPROFILE\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 ``` -------------------------------- ### Setup Non-Root User in Arch Linux Source: https://github.com/buildpacks/pack/wiki/Arch-Linux Creates a non-root user 'archie', installs sudo, and configures sudoers for passwordless sudo access. ```shell # setup non-root user useradd -m archie # add non-root user to sudoers pacman -Sy --noconfirm sudo echo 'archie ALL=(ALL:ALL) NOPASSWD:ALL' >> /etc/sudoers # switch to non-root user su - archie ``` -------------------------------- ### Run Arch Linux Container Source: https://github.com/buildpacks/pack/wiki/Arch-Linux Starts an interactive Arch Linux Docker container and provides a bash shell. ```shell docker run -it --rm archlinux /bin/bash ``` -------------------------------- ### Install Chocolatey and Core Packages Source: https://github.com/buildpacks/pack/wiki/Windows-WCOW-Docker-Daemon-on-Cloud-VM Installs Chocolatey package manager and essential development tools including Git, Golang, Make, and GNU Core Utilities. ```powershell Install-Package -Force chocolatey ``` ```powershell Install-ChocolateySoftware ``` ```powershell Install-ChocolateyPackage -Confirm:$false -Name git,golang,make,gnuwin32-coreutils.portable ``` -------------------------------- ### Install AUR Packaging Dependencies Source: https://github.com/buildpacks/pack/wiki/Arch-Linux Installs essential packages required for building AUR packages on Arch Linux. ```shell # setup AUR packaging deps sudo pacman -Sy --noconfirm git base-devel libffi ``` -------------------------------- ### Start ngrok TCP Tunnel for Docker Daemon Source: https://github.com/buildpacks/pack/wiki/Remote-Windows-Docker-Desktop On the remote Windows machine, run this command in PowerShell to expose the Docker daemon (port 2375) to the internet via an ngrok TCP tunnel. This allows remote access without SSH configuration. ```powershell ngrok tcp 2375 ``` -------------------------------- ### Set up Gitpod for Pack Development Source: https://github.com/buildpacks/pack/blob/main/DEVELOPMENT.md Use this link to launch a pre-configured cloud development environment for the Pack project directly in your browser. ```markdown [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/buildpacks/pack) ``` -------------------------------- ### Enable Pack Binary Execution (macOS/Linux) Source: https://github.com/buildpacks/pack/blob/main/CONTRIBUTING.md Make the downloaded pack binary executable. This command is specific to macOS and Linux systems. ```shell chmod +x ./pack ``` -------------------------------- ### Run All Tests Source: https://github.com/buildpacks/pack/blob/main/DEVELOPMENT.md A shortcut to execute all available tests, including unit, integration, and acceptance tests. ```shell make test ``` -------------------------------- ### Create GCP VM with Windows Server Core for Containers Source: https://github.com/buildpacks/pack/wiki/Windows-WCOW-Docker-Daemon-on-Cloud-VM Creates a Google Cloud VM instance with Windows Server Core optimized for containers and an SSD boot disk. Retrieves the VM's password after creation. ```bash gcloud compute instances create \ docker-windows \ --machine-type=e2-custom-4-4096 \ --image=windows-server-2019-dc-core-for-containers-v20201013 \ --image-project=windows-cloud \ --boot-disk-size=32GB \ --boot-disk-type=pd-ssd ``` ```bash gcloud compute reset-windows-password docker-windows --user dockeruser ``` -------------------------------- ### Build Pack Binary Source: https://github.com/buildpacks/pack/blob/main/DEVELOPMENT.md Compiles the Pack project. The resulting binary will be placed in the 'out/' directory. Environment variables can be used to customize the Go executable, binary name/location, and version. ```shell make build ``` -------------------------------- ### Create Azure VM with Windows Server Core for Containers Source: https://github.com/buildpacks/pack/wiki/Windows-WCOW-Docker-Daemon-on-Cloud-VM Sets up an Azure resource group and creates a VM within it using Windows Server Core for Containers. Configures RDP access and adds SSH to the existing RDP network security rule. ```bash az group create \ --location eastus \ --name docker-windows-vms ``` ```bash az vm create \ --name docker-windows \ --admin-username dockeruser \ --image MicrosoftWindowsServer:WindowsServer:2019-Datacenter-Core-with-Containers-smalldisk:2019.0.20190410 \ --nsg-rule RDP \ --storage-sku StandardSSD_LRS \ --size Standard_B2s \ --resource-group docker-windows-vms ``` ```bash az network nsg rule update \ --name rdp \ --nsg-name docker-windowsNSG \ --destination-port-ranges 22 3389 \ --resource-group docker-windows-vms ``` -------------------------------- ### Run Full Acceptance Suite Source: https://github.com/buildpacks/pack/blob/main/DEVELOPMENT.md Executes the complete acceptance test suite, ensuring cross-compatibility with previous versions of 'pack' and 'lifecycle'. ```shell make acceptance-all ``` -------------------------------- ### Unzip Pack Binary Source: https://github.com/buildpacks/pack/blob/main/CONTRIBUTING.md Unzip the downloaded pack binary for your platform. This is a necessary step before enabling execution. ```shell unzip pack-{{PLATFORM}}.zip ``` -------------------------------- ### Git Push: Add Remote and Initial Push Source: https://github.com/buildpacks/pack/wiki/Share-workspace-directory-to-remote-Windows-machine Add a remote Git repository pointing to the Windows machine and perform the initial push. This sets up the connection for subsequent pushes. ```bash git remote add windowsdevbox @35.236.212.142:c:\\Users\\\\workspace\\pack git push windowsdevbox ``` -------------------------------- ### Run Unit and Integration Tests Source: https://github.com/buildpacks/pack/blob/main/DEVELOPMENT.md Executes unit and integration tests. Test output is streamed to the terminal and saved in 'out/unit'. ```shell make unit ``` -------------------------------- ### Run Acceptance Tests Source: https://github.com/buildpacks/pack/blob/main/DEVELOPMENT.md Executes acceptance tests. Test output is streamed to the terminal and saved in 'out/acceptance'. ```shell make acceptance ``` -------------------------------- ### Git Push: Clone Repository on Windows Source: https://github.com/buildpacks/pack/wiki/Share-workspace-directory-to-remote-Windows-machine Clone your repository/branch on the Windows machine to initialize the workspace. Use 'receive.denyCurrentBranch=warn' to allow pushing to the current branch. ```powershell git clone --branch --config receive.denyCurrentBranch=warn https://github.com/buildpacks/pack c:\Users\\workspace\pack ``` -------------------------------- ### Connect to VM via SSH Source: https://github.com/buildpacks/pack/wiki/Windows-WCOW-Docker-Daemon-on-Cloud-VM Connects to the VM using SSH with a specified username and IP address, initiating a PowerShell session. ```bash ssh -t dockeruser@ powershell ``` -------------------------------- ### Check Local SSH Keys Source: https://github.com/buildpacks/pack/wiki/Remote-Windows-Docker-Desktop Verify that you have an SSH key configured on your local machine before proceeding with remote connections. ```shell ssh-add -l ``` -------------------------------- ### Enable Remote Desktop on Windows VM Source: https://github.com/buildpacks/pack/wiki/Windows-Docker-Daemon-on-Fusion-VM Execute these commands in an Administrator PowerShell on the Windows VM to enable Remote Desktop connections and firewall rules. ```powershell Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -name "fDenyTSConnections" -value 0 Enable-NetFirewallRule -DisplayGroup "Remote Desktop" ``` -------------------------------- ### Configure Docker Daemon and Hosts File Source: https://github.com/buildpacks/pack/wiki/Windows-WCOW-Docker-Daemon-on-Cloud-VM Configures Docker to use the VM's IP address as an insecure registry and updates the hosts file to map 'host.docker.internal' and 'gateway.docker.internal' to the VM's IP. This is done by modifying the Docker daemon configuration and the Windows hosts file. ```powershell echo ' $IPAddress=(Get-NetIPAddress -InterfaceAlias ((Get-NetRoute "0.0.0.0/0").InterfaceAlias) -AddressFamily IPv4)[0].IPAddress if (!(Get-NetfirewallRule -DisplayName test-registry)) { New-NetfirewallRule -DisplayName test-registry -LocalAddress $IPAddress } $config=@{} if (Test-Path C:\ProgramData\docker\config\daemon.json) { $config=(Get-Content C:\ProgramData\docker\config\daemon.json | ConvertFrom-json) } $config."insecure-registries" = @("$IPAddress/32") ConvertTo-json $config | Out-File -Encoding ASCII C:\ProgramData\docker\config\daemon.json $hostsContent=(Get-Content -Path C:\Windows\System32\drivers\etc\hosts -Raw) $hostsContent=($hostsContent -replace ".* host.docker.internal gateway.docker.internal","") $hostsContent += " ${IPAddress} host.docker.internal gateway.docker.internal" $hostsContent | Out-File -Encoding ASCII -FilePath C:\Windows\System32\drivers\etc\hosts ' | Out-File -Append -FilePath $env:USERPROFILE\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 ``` -------------------------------- ### Prepare for Pull Request Source: https://github.com/buildpacks/pack/blob/main/DEVELOPMENT.md Executes a series of checks to ensure the code is compliant and ready for submission as a pull request. ```shell make prepare-for-pr ``` -------------------------------- ### Configure Git Defaults for POSIX Compatibility Source: https://github.com/buildpacks/pack/wiki/Windows-WCOW-Docker-Daemon-on-Cloud-VM Sets Git configuration to use POSIX-style line endings (LF) and enable symbolic links, which is beneficial for cross-platform compatibility, especially when working with containers. ```bash git config --global core.autocrlf false ``` ```bash git config --global core.eol lf ``` ```bash git config --global core.symlinks true ``` -------------------------------- ### Establish SSH with Remote Port Forwarding Source: https://github.com/buildpacks/pack/wiki/Share-workspace-directory-to-remote-Windows-machine Connect to your Windows machine via SSH and set up a remote port forward. This directs traffic from port 50445 on the Windows machine back to port 445 on your workstation. ```bash ssh @ -R 50445:localhost:445 ``` -------------------------------- ### Add Exception for Pack Binary (macOS) Source: https://github.com/buildpacks/pack/blob/main/CONTRIBUTING.md A quick solution for macOS to allow the terminal to execute applications from unverified developers by adding an exception to the downloaded pack binary. ```shell sudo spctl --add -v ./pack ``` -------------------------------- ### Prepare SSH Keys for AUR Access Source: https://github.com/buildpacks/pack/wiki/Arch-Linux Manages SSH keys for accessing the AUR, clearing existing keys and adding a specific private key. ```shell # remove all existing keys ssh-add -D # add aur key ssh-add ~/.ssh/cnb-aur ``` -------------------------------- ### Tidy Codebase and Dependencies Source: https://github.com/buildpacks/pack/blob/main/DEVELOPMENT.md Cleans up the project's codebase and manages dependencies, ensuring all are necessary and correctly defined. ```shell make tidy ``` -------------------------------- ### Share Files Source: https://github.com/buildpacks/pack/wiki/Windows-WCOW-Docker-Daemon-on-Cloud-VM Alternatively, share files directly from your workstation to the remote Windows machine. Refer to the provided link for detailed instructions on setting up workspace sharing. ```markdown Share files directly from your workstation ([instructions](https://github.com/buildpacks/pack/wiki/Forward-workspace-directory-to-remote-Windows-machine)) ``` -------------------------------- ### Publish AUR Package Changes Source: https://github.com/buildpacks/pack/wiki/Arch-Linux Generates the .SRCINFO file, stages changes, commits them with a signed-off-by tag, and pushes to the AUR repository. ```shell # regenerate .SRCINFO makepkg --printsrcinfo > .SRCINFO # stage changes git add PKGBUILD .SRCINFO # commit changes git commit -s # publish changes git push ``` -------------------------------- ### Mount SMB Share on Windows Source: https://github.com/buildpacks/pack/wiki/Share-workspace-directory-to-remote-Windows-machine In the SSH session, mount the port-forwarded SMB drive from your workstation. You will be prompted for your workstation's share-user credentials. ```powershell New-SmbGlobalMapping ` -RemotePath \localhost\workspace ` -LocalPath w: ` -Credential (New-Object -TypeName PSCredential -ArgumentList @((Read-Host "Username"),(Read-Host "Password" -AsSecureString))) # Username: \ ## Ex `laptop\share` # Password: **************** cd w:\ ``` -------------------------------- ### Add Git Binaries to PATH Source: https://github.com/buildpacks/pack/wiki/Windows-WCOW-Docker-Daemon-on-Cloud-VM Appends the Git binary directory to the system's PATH environment variable to make Git commands accessible. ```powershell $currentPath = (Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" -Name PATH).Path Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" -Name PATH -Value "$currentPath;c:\Program Files\git\mingw64\bin\" ``` -------------------------------- ### Configure Windows Port Forwarding for SMB Source: https://github.com/buildpacks/pack/wiki/Share-workspace-directory-to-remote-Windows-machine This command configures Windows to forward traffic from localhost:445 to localhost:50445, which is necessary for SMB access. It also disables the server service to prevent conflicts. ```powershell netsh interface portproxy add v4tov4 listenaddress=127.0.0.1 listenport=445 connectaddress=127.0.0.1 connectport=50445 Stop-Service lanmanserver -Force Set-Service lanmanserver -StartupType disabled #Windows 10 only: Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\com.docker.service DependOnService -Value @() ``` -------------------------------- ### Format Code Source: https://github.com/buildpacks/pack/blob/main/DEVELOPMENT.md Applies code formatting rules to the entire project to ensure consistent style. ```shell make format ``` -------------------------------- ### Configure Windows VM for Docker Source: https://github.com/buildpacks/pack/wiki/Windows-WCOW-Docker-Daemon-on-Cloud-VM Sets execution policy to unrestricted, changes the timezone to UTC, and configures the default SSH shell to PowerShell. It also sets up a profile script to reload the PATH environment variable on each SSH login. ```powershell Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force ``` ```powershell Set-Timezone -Id UTC ``` ```powershell Set-ItemProperty HKLM:\SOFTWARE\OpenSSH\ DefaultShell -Value C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe ``` ```powershell mkdir $env:USERPROFILE\Documents\WindowsPowerShell echo ' $env:PATH=(Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" -Name PATH).Path $env:PATH+=+;(Get-ItemProperty -Path "HKCU:\Environment" -Name PATH).Path ' | Out-File -FilePath $env:USERPROFILE\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 ``` -------------------------------- ### Schedule Daily Shutdown for Cost Savings Source: https://github.com/buildpacks/pack/wiki/Windows-WCOW-Docker-Daemon-on-Cloud-VM Schedules a daily shutdown task to minimize cloud VM costs. The shutdown is set for 8 hours from the current time. ```powershell schtasks /create /st (Get-Date).AddHours(8).ToString("HH:mm") /sc daily /tr "shutdown -s" /tn "minimize cost" ``` -------------------------------- ### Verify Formatting and Code Quality Source: https://github.com/buildpacks/pack/blob/main/DEVELOPMENT.md Runs checks to ensure code formatting and quality standards are met across the project. ```shell make verify ``` -------------------------------- ### Update Fork and Disable Workflows with test-fork.sh Source: https://github.com/buildpacks/pack/blob/main/DEVELOPMENT.md This script helps manage your forked repository by updating source code and disabling unnecessary workflows. Provide the registry repository name as an argument. ```shell ./tools/test-fork.sh ``` -------------------------------- ### Feedback Template for Pull Requests Source: https://github.com/buildpacks/pack/blob/main/CONTRIBUTING.md A template for providing feedback on pull requests, including a title, summary, expected behavior, and observed output or logs. ```text #### ###### Expected ###### Output ``` -------------------------------- ### Uninstall pack-cli-bin Source: https://github.com/buildpacks/pack/wiki/Arch-Linux Removes the pack-cli-bin package from the system using pacman. ```shell # uninstall pack-cli-bin sudo pacman -R pack-cli-bin ``` -------------------------------- ### Retest Docker Daemon Connection after Setting DOCKER_HOST Source: https://github.com/buildpacks/pack/wiki/Remote-Windows-Docker-Desktop After setting the DOCKER_HOST environment variable, run `docker info` to confirm that your local Docker client is successfully communicating with the remote Docker daemon. ```shell docker info ``` -------------------------------- ### Test Remote Docker Daemon Connection via SSH Source: https://github.com/buildpacks/pack/wiki/Remote-Windows-Docker-Desktop Verify that you can connect to the remote Docker daemon using SSH and retrieve its info. Replace `` and `` with your actual username and the remote machine's hostname or IP address. ```shell docker -H ssh://@ info ``` -------------------------------- ### Clone Repository Source: https://github.com/buildpacks/pack/wiki/Windows-WCOW-Docker-Daemon-on-Cloud-VM Use this command to clone your Git repository to the remote Windows machine. Ensure you specify the correct repository URL and branch. ```powershell git clone https://github.com/my-fork/my-repo -b my-branch ``` -------------------------------- ### Clone AUR Packages Source: https://github.com/buildpacks/pack/wiki/Arch-Linux Clones the pack-cli and pack-cli-bin repositories from the AUR using SSH. ```shell # download pack-cli git clone ssh://aur@aur.archlinux.org/pack-cli.git # download pack-cli-bin git clone ssh://aur@aur.archlinux.org/pack-cli-bin.git ``` -------------------------------- ### Restart Windows Machine Source: https://github.com/buildpacks/pack/wiki/Share-workspace-directory-to-remote-Windows-machine Restart your Windows machine to apply the service configuration changes. ```powershell shutdown -r -t 0 ``` -------------------------------- ### Uninstall pack-cli Source: https://github.com/buildpacks/pack/wiki/Arch-Linux Removes the pack-cli package from the system using pacman. ```shell # uninstall pack-cli sudo pacman -R pack-cli ``` -------------------------------- ### Git Push: Commit and Push Changes Source: https://github.com/buildpacks/pack/wiki/Share-workspace-directory-to-remote-Windows-machine Commit all changes and push them to the remote Windows machine. This automatically updates the current branch on the remote. ```bash git commit --all --message "Work in progress" git push windowsdevbox ``` ```bash git commit --all --message "WIP" git push windowsdevbox ``` -------------------------------- ### Restart Docker Service Source: https://github.com/buildpacks/pack/wiki/Windows-WCOW-Docker-Daemon-on-Cloud-VM Restarts the Docker service to apply the new configuration changes. ```powershell Restart-Service docker ``` -------------------------------- ### Copy Local SSH Key to Remote Host Source: https://github.com/buildpacks/pack/wiki/Remote-Windows-Docker-Desktop Transfer your local SSH public key to the remote Windows host to enable passwordless SSH authentication. ```shell ssh-copy-id @ ``` -------------------------------- ### Remove SMB Drive Mappings Source: https://github.com/buildpacks/pack/wiki/Share-workspace-directory-to-remote-Windows-machine If necessary, you can remove existing SMB drive mappings using this command. ```powershell Get-SmbGlobalMapping | Remove-SmbGlobalMapping -Force ``` -------------------------------- ### Git Push: Reset Branch on Windows Source: https://github.com/buildpacks/pack/wiki/Share-workspace-directory-to-remote-Windows-machine After pushing changes from the workstation, reset the branch on the Windows machine to the latest pushed commits to ensure the workspace is up-to-date. ```powershell git reset --hard HEAD ``` -------------------------------- ### Set DOCKER_HOST Environment Variable for SSH Source: https://github.com/buildpacks/pack/wiki/Remote-Windows-Docker-Desktop Configure your local environment to use the remote Docker daemon via SSH by setting the DOCKER_HOST environment variable. This allows subsequent `docker` commands to target the remote daemon without explicitly specifying the host. ```zsh export DOCKER_HOST=ssh://@ ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.