Docker Linux On Windows 10



  1. Docker Linux Image On Windows 10
  2. Docker On Windows 10 Linux Subsystem
  3. Docker Linux On Windows 10
  4. Install Docker Linux On Windows 10
  5. Docker Kali Linux Windows 10
  • As far as Windows is concerned Docker is just another distro that runs on top of Linux’s kernel. The integration between Docker Desktop really enables different distro to talk to each other so in our case, Ubuntu was able to run and execute commands that affect the other VM running inside the docker distro.
  • Just checking the Task Manager should help people if they should use Docker for Windows or the Docker Toolbox. Current 'Getting Started' says this - Docker for Windows requires 64bit Windows 10 Pro, Enterprise and Education (1511 November update, Build 10586 or later) and Microsoft Hyper-V.
  • The Windows image is not covered, but you can learn more about it on the mssql-server-windows-developer Docker Hub page. Docker Engine 1.8+ on any supported Linux distribution or Docker for Mac/Windows. For more information, see Install Docker. Docker overlay2 storage driver. This is the default for most users.
-->

'c: program files docker docker Docker for Windows.exe' c: program files docker docker Docker for Windows.exe – Alsushi May 9 '20 at 16:26 I've made a bat file with the script but when I execute it the cmd remains with the blinking caret instead of exiting. In this article we’ve learned how to set up a Linux development environment using Docker containers and WSL 2, with Windows 10 Pro. This is a nice approach for anybody who’s confortable on Windows and needs access to a Linux environment for development; and have that environment be easy to reproduce.

Applies to: SQL Server (all supported versions) - Linux

Note

The examples shown below use the docker.exe but most of these commands also work with Podman. It provides the CLI similar to Docker container Engine. You can read more about podman here.

In this quickstart, you use Docker to pull and run the SQL Server 2017 container image, mssql-server-linux. Then connect with sqlcmd to create your first database and run queries.

Tip

If you want to run SQL Server 2019 containers, see the SQL Server 2019 version of this article.

Note

Starting with SQL Server 2019 CU3, Ubuntu 18.04 is supported.

In this quickstart, you use Docker to pull and run the SQL Server 2019 container image, mssql-server. Then connect with sqlcmd to create your first database and run queries.

Tip

This quickstart creates SQL Server 2019 containers. If you prefer to create SQL Server 2017 containers, see the SQL Server 2017 version of this article.

This image consists of SQL Server running on Linux based on Ubuntu 18.04. It can be used with the Docker Engine 1.8+ on Linux or on Docker for Mac/Windows. This quickstart specifically focuses on using the SQL Server on Linux image. The Windows image is not covered, but you can learn more about it on the mssql-server-windows-developer Docker Hub page.

Prerequisites

  • Docker Engine 1.8+ on any supported Linux distribution or Docker for Mac/Windows. For more information, see Install Docker.
  • Docker overlay2 storage driver. This is the default for most users. If you find that you are not using this storage provider and need to change, see the instructions and warnings in the docker documentation for configuring overlay2.
  • Minimum of 2 GB of disk space.
  • Minimum of 2 GB of RAM.
  • System requirements for SQL Server on Linux.

Pull and run the 2017 container image

Before starting the following steps, make sure that you have selected your preferred shell (bash, PowerShell, or cmd) at the top of this article.

  1. Pull the SQL Server 2017 Linux container image from Microsoft Container Registry.

    Tip

    If you want to run SQL Server 2019 containers, see the SQL Server 2019 version of this article.

    The previous command pulls the latest SQL Server 2017 container image. If you want to pull a specific image, you add a colon and the tag name (for example, mcr.microsoft.com/mssql/server:2017-GA-ubuntu). To see all available images, see the mssql-server Docker hub page.

    For the bash commands in this article, sudo is used. On macOS, sudo might not be required. On Linux, if you do not want to use sudo to run Docker, you can configure a docker group and add users to that group. For more information, see Post-installation steps for Linux.

  2. To run the container image with Docker, you can use the following command from a bash shell (Linux/macOS) or elevated PowerShell command prompt.

    Note

    If you are using PowerShell Core, replace the double quotes with single quotes.

    Note

    The password should follow the SQL Server default password policy, otherwise the container can not setup SQL server and will stop working. By default, the password must be at least 8 characters long and contain characters from three of the following four sets: Uppercase letters, Lowercase letters, Base 10 digits, and Symbols. You can examine the error log by executing the docker logs command.

    By default, this creates a container with the Developer edition of SQL Server 2017. The process for running production editions in containers is slightly different. For more information, see Run production container images.

    The following table provides a description of the parameters in the previous docker run example:

    ParameterDescription
    -e 'ACCEPT_EULA=Y'Set the ACCEPT_EULA variable to any value to confirm your acceptance of the End-User Licensing Agreement. Required setting for the SQL Server image.
    -e 'SA_PASSWORD=<YourStrong@Passw0rd>'Specify your own strong password that is at least 8 characters and meets the SQL Server password requirements. Required setting for the SQL Server image.
    -p 1433:1433Map a TCP port on the host environment (first value) with a TCP port in the container (second value). In this example, SQL Server is listening on TCP 1433 in the container and this is exposed to the port, 1433, on the host.
    --name sql1Specify a custom name for the container rather than a randomly generated one. If you run more than one container, you cannot reuse this same name.
    -h sql1Used to explicitly set the container hostname, if you don't specify it, it defaults to the container ID which is a randomly generated system GUID.
    -dRun the container in the background (daemon)
    mcr.microsoft.com/mssql/server:2017-latestThe SQL Server 2017 Linux container image.
  3. To view your Docker containers, use the docker ps command.

    You should see output similar to the following screenshot:

  4. If the STATUS column shows a status of Up, then SQL Server is running in the container and listening on the port specified in the PORTS column. If the STATUS column for your SQL Server container shows Exited, see the Troubleshooting section of the configuration guide.

The -h (host name) parameter as discussed above, changes the internal name of the container to a custom value. This is the name you'll see returned in the following Transact-SQL query:

Setting -h and --name to the same value is a good way to easily identify the target container.

  1. As a final step, change your SA password because the SA_PASSWORD is visible in ps -eax output and stored in the environment variable of the same name. See steps below.

Pull and run the 2019 container image

Before starting the following steps, make sure that you have selected your preferred shell (bash, PowerShell, or cmd) at the top of this article.

  1. Pull the SQL Server 2019 Linux container image from Microsoft Container Registry.

    Note

    If you are using PowerShell Core, replace the double quotes with single quotes.

    Tip

    This quickstart uses the SQL Server 2019 Docker image. If you want to run the SQL Server 2017 image, see the SQL Server 2017 version of this article.

    The previous command pulls the SQL Server 2019 container image based on Ubuntu. To instead use container images based on RedHat, see Run RHEL-based container images. To see all available images, see the mssql-server-linux Docker hub page.

    For the bash commands in this article, sudo is used. On macOS, sudo might not be required. On Linux, if you do not want to use sudo to run Docker, you can configure a docker group and add users to that group. For more information, see Post-installation steps for Linux.

  2. To run the container image with Docker, you can use the following command from a bash shell (Linux/macOS) or elevated PowerShell command prompt.

    Note

    The password should follow the SQL Server default password policy, otherwise the container can not setup SQL server and will stop working. By default, the password must be at least 8 characters long and contain characters from three of the following four sets: Uppercase letters, Lowercase letters, Base 10 digits, and Symbols. You can examine the error log by executing the docker logs command.

    By default, this creates a container with the Developer edition of SQL Server 2019.

    The following table provides a description of the parameters in the previous docker run example:

    ParameterDescription
    -e 'ACCEPT_EULA=Y'Set the ACCEPT_EULA variable to any value to confirm your acceptance of the End-User Licensing Agreement. Required setting for the SQL Server image.
    -e 'SA_PASSWORD=<YourStrong@Passw0rd>'Specify your own strong password that is at least 8 characters and meets the SQL Server password requirements. Required setting for the SQL Server image.
    -p 1433:1433Map a TCP port on the host environment (first value) with a TCP port in the container (second value). In this example, SQL Server is listening on TCP 1433 in the container and this is exposed to the port, 1433, on the host.
    --name sql1Specify a custom name for the container rather than a randomly generated one. If you run more than one container, you cannot reuse this same name.
    -h sql1Used to explicitly set the container hostname, if you don't specify it, it defaults to the container ID which is a randomly generated system GUID.
    mcr.microsoft.com/mssql/server:2019-latestThe SQL Server 2019 Ubuntu Linux container image.
  3. To view your Docker containers, use the docker ps command.

    You should see output similar to the following screenshot:

  4. If the STATUS column shows a status of Up, then SQL Server is running in the container and listening on the port specified in the PORTS column. If the STATUS column for your SQL Server container shows Exited, see Troubleshooting SQL Server Docker containers.

The -h (host name) parameter as discussed above, changes the internal name of the container to a custom value. This changes the internal name of the container to a custom value. This is the name you'll see returned in the following Transact-SQL query:

Run

Setting -h and --name to the same value is a good way to easily identify the target container.

  1. As a final step, change your SA password because the SA_PASSWORD is visible in ps -eax output and stored in the environment variable of the same name. See steps below.

Change the SA password

The SA account is a system administrator on the SQL Server instance that gets created during setup. After creating your SQL Server container, the SA_PASSWORD environment variable you specified is discoverable by running echo $SA_PASSWORD in the container. For security purposes, change your SA password.

  1. Choose a strong password to use for the SA user.

  2. Use docker exec to run sqlcmd to change the password using Transact-SQL. In the following example, replace the old password, <YourStrong!Passw0rd>, and the new password, <YourNewStrong!Passw0rd>, with your own password values.

Connect to SQL Server

The following steps use the SQL Server command-line tool, sqlcmd, inside the container to connect to SQL Server.

  1. Use the docker exec -it command to start an interactive bash shell inside your running container. In the following example sql1 is name specified by the --name parameter when you created the container.

  2. Once inside the container, connect locally with sqlcmd. Sqlcmd is not in the path by default, so you have to specify the full path.

    Tip

    You can omit the password on the command-line to be prompted to enter it.

  3. If successful, you should get to a sqlcmd command prompt: 1>.

Create and query data

The following sections walk you through using sqlcmd and Transact-SQL to create a new database, add data, and run a query.

Create a new database

The following steps create a new database named TestDB.

  1. From the sqlcmd command prompt, paste the following Transact-SQL command to create a test database:

  2. On the next line, write a query to return the name of all of the databases on your server:

  3. The previous two commands were not executed immediately. Type GO on a new line to execute the previous commands:

Insert data

Next create a new table, Inventory, and insert two new rows.

  1. From the sqlcmd command prompt, switch context to the new TestDB database:

  2. Create new table named Inventory:

  3. Insert data into the new table:

  4. Type GO to execute the previous commands:

Select data

Now, run a query to return data from the Inventory table.

  1. From the sqlcmd command prompt, enter a query that returns rows from the Inventory table where the quantity is greater than 152:

  2. Execute the command:

Docker Linux Image On Windows 10

Exit the sqlcmd command prompt

  1. To end your sqlcmd session, type QUIT:

  2. To exit the interactive command-prompt in your container, type exit. Your container continues to run after you exit the interactive bash shell.

Connect from outside the container

You can also connect to the SQL Server instance on your Docker machine from any external Linux, Windows, or macOS tool that supports SQL connections.

The following steps use sqlcmd outside of your container to connect to SQL Server running in the container. These steps assume that you already have the SQL Server command-line tools installed outside of your container. The same principles apply when using other tools, but the process of connecting is unique to each tool.

  1. Find the IP address for the machine that hosts your container. On Linux, use ifconfig or ip addr. On Windows, use ipconfig.

  2. For this example, install the sqlcmd tool on your client machine. For more information, see Install sqlcmd on Windows or Install sqlcmd on Linux.

  3. Run sqlcmd specifying the IP address and the port mapped to port 1433 in your container. In this example, that is the same port, 1433, on the host machine. If you specified a different mapped port on the host machine, you would use it here. You will also need to open the appropriate inbound port on your firewall to allow the connection.

  4. Run Transact-SQL commands. When finished, type QUIT.

Other common tools to connect to SQL Server include:

Remove your container

If you want to remove the SQL Server container used in this tutorial, run the following commands:

Warning

Stopping and removing a container permanently deletes any SQL Server data in the container. If you need to preserve your data, create and copy a backup file out of the container or use a container data persistence technique.

Docker demo

After you have tried using the SQL Server container image for Docker, you might want to know how Docker is used to improve development and testing. The following video shows how Docker can be used in a continuous integration and deployment scenario.

Next steps

For a tutorial on how to restore database backup files into a container, see Restore a SQL Server database in a Linux Docker container. Explore other scenarios, such as running multiple containers, data persistence, and troubleshooting.

Also, check out the mssql-docker GitHub repository for resources, feedback, and known issues.

-->

This article outlines Microsoft's support policy concerning Windows containers and Docker for on-premises deployments.

Original product version: Windows Server 2019, Windows Server 2016, Windows Server 2012 R2, Windows 10 - all editions
Original KB number: 4489234

Note

When customers experience issues with or have questions about Windows containers and related Docker functionality, Microsoft is their first point of contact. For similar information about Microsoft's support policy for containers in Azure, see Support policy for containers and related services on Azure.

Supported configurations for container hosts

Microsoft defines the supported host configurations in the following terms:

  • Host operating system: Windows Server or Windows 10.

  • Hypervisor: Windows 10 must run Hyper-V to support containers; Windows Server, as shown in the table, has more flexibility.

  • Docker engine: Docker is a third-party application for managing containers. Docker Enterprise runs on Windows Server; Docker Desktop for Windows runs in Windows 10. For more information about Docker, see Docker on Windows.

  • Container type: Microsoft supports Windows Server containers, Hyper-V containers, and Linux containers. However, not all host configurations can support all of the container types. For general information about Windows containers and container types, see Containers on Windows.

Note

The Linux Containers on Windows (LCOW) feature is under active development. For more information, see Linux Containers on Windows. You can track ongoing progress in the Moby project on GitHub.

Host component support

Customers that deploy Windows Server containers on supported Windows Server versions running on physical hardware or virtual machine on Hyper-V will receive full support for issues that are related to the operating system and/or container engine.

Supported configurations for Windows Server container hosts

Microsoft supports Windows containers on the following versions and releases of Windows Server:

  • Windows Server 2019 (1809) Standard or Datacenter editions
  • Windows Server 2016 (1803) Standard or Datacenter editions
  • Windows Server 2016 (1709) Standard or Datacenter editions
  • Windows Server 2016 (1607) Standard, Datacenter, or Nano Server editions
  • Windows IoT core (only available to Windows Insider members)

Note

You cannot host containers on Windows Server, Nano Server edition, on any Windows Server release later than 1607.

Microsoft supports Windows containers on both LTSC and Semi-annual Channel (SAC) releases. For information about the support lifecycles for Windows versions and releases, see Windows Server Semi-Annual Channel overview.

To deploy containers in Windows Server, you must install Docker Enterprise (see Install Docker Engine - Enterprise on Windows Servers). Docker provides full support for Docker Enterprise at Docker support.

On these versions of Windows, the types of containers that Microsoft supports depends on whether your host is a physical computer or a virtual machine, and whether Windows is running with Hyper-V enabled.

Supported container types on a physical container host

HypervisorSupported container types
NoneWindows Server containers
Hyper-V
  • Windows Server containers
  • Hyper-V containers
  • Linux containers

Supported container types on a virtual machine container host

VM host hypervisorGuest OSGuest hypervisorSupported container types
Hyper-VWindows Server (full or core)NoneWindows Server containers
Hyper-VWindows Server (full or core)Hyper-V (must be running in nested virtualization mode)Windows Server containers Hyper-V containers
Hyper-VLinuxLinuxLinux containers
VMWare ESXWindows Server (full or core)None (Hyper-V not supported on VMWare ESX)Windows Server containers

Supported configurations for Windows 10 container hosts

Microsoft supports containers on Windows 10 Professional or Enterprise with Anniversary Update (version 1607) or later, with the following requirements:

  • Hyper-V must be enabled

  • Docker Desktop for Windows must be installed (see Install Docker Desktop for Windows). Docker Desktop for Windows is the Community Edition (Docker CE) and is ideal for developers and small teams looking to get started with Docker and experimenting with container-based apps.

    Microsoft does not provide support for Docker Desktop for Windows. Support is only provided through the Docker Community Forums. For more information, see 'What if I have problems or questions?' in the Docker for Windows FAQ at Docker FAQ.

You can use Hyper-V containers or Linux containers on Windows 10. You cannot use Windows Server containers.

Microsoft does not support containers on virtual machines that are hosted on a Windows 10 computer. To use containers on a virtual machine, use Windows Server as the virtual machine host.

Requirements for container hosts

For information about requirements for container hosts, see:

For information about requirements and compatibility issues for virtualization, see Windows Server Catalog: Server Virtualization Validation Program.

To run Hyper-V containers, the container host must meet the requirements for running Hyper-V itself. To summarize, Hyper-V requires:

  • 64-bit processor, with the following capabilities:

    • Second-level address translation (SLAT): The Windows hypervisor functionality requires SLAT (the Hyper-V management tools do not.

    • Hardware-assisted virtualization: This is available in processors that include a virtualization option - specifically processors with Intel Virtualization Technology (Intel VT) or AMD Virtualization (AMD-V) technology.

    • Hardware-enforced Data Execution Prevention (DEP) must be available and enabled. For Intel systems, this is the XD bit (execute disable bit). For AMD systems, this is the NX bit (no execute bit).

  • VM Monitor Mode extensions.

  • At least 4 GB of RAM. More memory is better. You'll need enough memory for the host and all virtual machines that you want to run at the same time.

  • Virtualization support turned on in the BIOS or UEFI.

For more information, see System requirements for Hyper-V on Windows Server.

Supported container orchestrators

The Azure Service Fabric is not available to orchestrate on-premises containers. Windows does support Docker swarm, Kubernetes, and Red Hat orchestrators.

  • Docker swarm: Docker swarm is a feature of the Docker engine. Docker swarm is fully supported by Docker. For more information about using Docker swarm with Windows containers, see Getting started with swarm mode.

  • Kubernetes: Kubernetes for on-premises Windows Server deployments is still in preview (Beta). Microsoft will not provide any support until the official announcement of general availability. Until then, use the following resources:

    • For the latest information about functionality with Windows Server 2016 and Windows Server 2019, see Kubernetes on Windows.

    • To track development and participate in community preview efforts, follow the Kubernetes #SIG-Windows community.

  • Red Hat OpenShift (Windows Server 2019 only): Red Hat OpenShift on Windows Server 2019 is still in private preview. Microsoft will not provide support until the announcement of general availability.

Supported container images

Microsoft offers four container base images for Windows:

  • Windows Server core: If your application needs the full .NET framework, this is the best image to use.
  • Nano Server: For applications that only require .NET Core, Nano Server will provide a much slimmer image.
  • Windows: You may find your application depends on a component or .dll that is missing in Server Core or Nano Server images, such as GDI libraries. This image carries the full dependency set of Windows.
  • Windows IoT core: This image is purpose-built for IoT applications. You should use this container image when targeting an IoT Core host.

Note

The IoT Core base image is only available to members of the Windows Insider program.

As outlined in Supported container hosts, not all host operating systems support both Windows Server containers and Hyper-V containers. Similarly, not all of the base images support both container types. The following table outlines which container types you can create using each base image on each of the host operating systems.

Container base OS images that are supported on Windows container hosts

Container host OSWindows Server coreNano ServerWindowsWindows IoT core
Windows Server 2016 or 2019 Standard or DatacenterWindows Server containers
Hyper-V containers
Windows Server containers
Hyper-V containers
Windows Server containers
Hyper-V containers
Not supported
Windows Server 2016 Nano ServerNot supportedWindows Server containers
Hyper-V containers
Hyper-V containersNot supported
Windows 10 Professional or EnterpriseHyper-V containersHyper-V containersHyper-V containersNot supported
Windows IoT coreNot supportedNot supportedNot supportedWindows Server containers

If you plan to work with container hosts that run different versions and releases of Windows, you will also need to consider the versions and releases of the container images. Some container features are not backward-compatible, so some newer base OS images may not run on container hosts with older OS versions. For more detailed information about compatibility issues between base OS image versions and host OS versions, see Windows Container Version Compatibility.

Support for container workloads

Microsoft fully supports its container base OS images, as described in this section. For support of Microsoft applications in containers, see GitHub, the Microsoft forums, or the Microsoft repository on DockerHub for the custom container image in question.

When running third-party applications in Windows containers, refer to the application vendor for support. In particular, confirm with the application vendor that they support running the application in a Windows container.

Supported networking configurations

Microsoft fully supports Windows container networking functionality. This functionality includes the Host Networking Service (HNS) and Host Compute Service (HCS). HNS and HCS work together to create containers (HCS) and attach endpoints to a network (HNS). Additionally, it includes the following container network drivers (for full descriptions of these drivers, see Windows Container Network Drivers):

Docker On Windows 10 Linux Subsystem

  • Network Address Translation (NAT): This is the default driver for container networks. NAT networks support port forwarding and mapping from container hosts to container endpoints. Microsoft supports multiple NAT networks on Windows 10 container hosts that have Windows 10, version 1703 (also known as the Creators Update) installed.

  • Transparent: When configured with a user-specified subnet, transparent networks support static IP addresses from the physical network or dynamic IP addresses assigned by an external DHCP server. When using a transparent network for containers on a virtual container host, you must configure MAC address spoofing.

  • Overlay: Microsoft supports overlay networks for use with Docker swarm or Kubernetes orchestration. To use overlay networks, your configuration must meet the following requirements:

    • Your container hosts run Windows Server 2019, Windows Server 2016, or Windows 10 Creators Update.

    • Your deployment meets the requirements listed in Using overlay networks.

    • When using Kubernetes, you are using Flannel or OVN control panes.

      Note

      Kubernetes for on-premises Windows Server deployments is still in preview (Beta). For information about Kubernetes support, see Supported container orchestrators.

  • L2Bridge: Microsoft supports L2Bridge networks to assign containers to the same IP subnet as the container host. To use L2Bridge networks, your configuration must meet the following requirements:

    • Your container hosts run Windows Server 2019, Windows Server 2016, or Windows 10 Creators Update.

    • IP addresses must be assigned statically from the same prefix as the container host.

    • You configure MAC address spoofing.

  • L2Tunnel: Microsoft primarily supports L2Tunnel networks for use in a Microsoft Cloud Stack. Otherwise, requirements for L2Tunnel networks resemble the requirements for L2Bridge networks.

Docker Linux On Windows 10

Advanced network options - supported and unsupported

Docker Linux On Windows 10

Microsoft supports switch-embedded teaming for container host networks used by Docker. Microsoft does not support any other NIC teaming configuration for container networking. For more information, see Advanced Network Options in Windows.

Microsoft does not support the following features for container networking:

  • IPSec encryption for container communication

  • HTTP proxy configuration for containers. You can track a preliminary PR for this feature at Changes to support registry modification in containers.

  • Attaching endpoints to running Hyper-V containers (hot-add)

Microsoft does not support the following commands and options for Docker:

CommandUnsupported options
Docker run
  • --ip6
  • --dns-option
Docker network create
  • --aux-address
  • --internal
  • --ip-range
  • --ipam-driver
  • --ipam-opt
  • --ipv6
  • --opt encrypted

Supported service accounts for containers

Microsoft supports Active Directory group Managed Service Accounts (gMSAs) for containers.

Containers cannot be domain-joined. By using Group Managed Service Accounts (gMSAs), Windows containers themselves and the services they host can be configured to use a specific gMSA as their domain identity. Any service running as Local System or Network Service will use the Windows container's identity just like they use the domain-joined host's identity. For information about using gMSAs, see:

Supported endpoint security options for containers and container hosts

Install Docker Linux On Windows 10

Microsoft supports Windows Defender to protect container hosts. However, it does not support Windows Defender to run within containers.

Docker Kali Linux Windows 10

Docker provides information about third-party providers and their endpoint protection products at Endpoint security for Windows containers. When using a third-party product, verify that the provider supports the product for containers. Be aware of any issues and limitations related to running the product within a container. Additionally, for recommendations about how to configure anti-virus protection to work with containers, see Anti-virus optimization for Windows Containers.