Docker Desktop 4.13.0 introduces a New Dev Environment CLI for the first time
Published: 2022-10-23 10:02:46

[Docker Desktop 4.13.0](https://docs.docker.com/desktop/release-notes/#new) is now available for Docker developers to [download and install](https://docs.docker.com/desktop/release-notes/#docker-desktop-4130) on all the leading platforms - [MacOS](https://desktop.docker.com/mac/main/arm64/Docker.dmg?utm_source=docker&utm_medium=webreferral&utm_campaign=docs-driven-download-mac-arm64), [Linux](https://desktop.docker.com/linux/main/amd64/docker-desktop-4.13.0-amd64.deb?utm_source=docker&utm_medium=webreferral&utm_campaign=docs-driven-download-linux-amd64) and [Windows](https://desktop.docker.com/win/main/amd64/Docker%20Desktop%20Installer.exe?utm_source=docker&utm_medium=webreferral&utm_campaign=docs-driven-download-win-amd64). It comes with the latest  [Kubernetes v1.25.2] (https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.25.md#v1252), [Compose v2.12.0](https://github.com/docker/compose/releases/tag/v2.12.0) and [Snyk v1.1025.0](https://github.com/snyk/cli/compare/v1.1024.0...v1.1025.0).



This release introduced a new Docker CLI plugin for the first time called `docker dev`. The `docker dev` is a new Dev Environments CLI that lets you create, list, and run Dev Envs via the command line. It means that now it’s damn easier to integrate Dev Envs into custom scripts.

## What is Dev Environment?

Dev Environment helps developers to create a configurable developer environment with all the code and tools you need to quickly get up and running. Using Dev Environment, developer can:

- Use a container locally as a full development environment.
- Share code (including dependencies) with your team members in one click.
- Move quickly between branches or run them side by side in VSCode.


## Test driving Docker Dev Environment CLI

Ensure that you have the latest version of Docker Desktop 4.13.0+ up and running on your laptop.

```
% docker dev

Usage:  docker dev [OPTIONS] COMMAND

Docker Dev Environments CLI interface

Options:
  -s, --socket string   Sets the path to the unix socket or pipe to be
                        targeted. Can also be set through the environment
                        variable DOCKER_DEV_ENVS_SOCKET_PATH
  -v, --version         Display version of the dev plugin

Management Commands:
  service     Service management on a dev environment

Commands:
  check       Check Dev Environments
  create      Create a new dev environment
  list        Lists all Dev Environments
  logs        Traces logs from a dev environment
  open        Open Dev Environment with the IDE
  rm          Removes a dev environment
  start       Starts a dev environment
  stop        Stops a dev environment
  version     Show the Docker Dev version information

Run 'docker dev COMMAND --help' for more information on a command.
unknown docker command: dev []

```

## Viewing the Docker Dev version information

```
docker dev version
Version:    v0.0.3
Git commit: 2fdb7c4
```




## Checking the Dev Environments


```
docker dev check
GIT         VSCODE        REMOTE_CONTAINERS
true        true          true
```

## Listing the existing Dev Environments

```
docker dev list 
NAME        STATUS
```

## Creating a New Dev Environment

```
docker dev create --help

Usage:  docker dev create [OPTIONS] REPOSITORY_URL

Create a new dev environment

Aliases:
  create, new

Options:
  -d, --detach   Detach creates a Dev Env without attaching to it's logs
  -o, --open     Open IDE after a successful creation
```

## Cloning the Awesome-compose Repository

With over 18,700 stars and 2,900 forks, awesome-compose is a popular Docker repository that contains a curated list of Docker Compose samples. It helps developers learn about Docker Compose by providing a starting point for integrating different services using a Compose file and managing their deployment with Docker Compose. This project is hosted over Docker GitHub organization, Inc and publicly open for the community to contribute and submit their compose file.

Let us pick up a sample [Python/Flask app using a Redis database](https://github.com/docker/awesome-compose/tree/master/flask-redis).

```

docker dev create https://github.com/docker/awesome-compose/tree/master/flask-redis
```

Results:

```
awesome-compose-beautiful_moser
Preparing to clone inside a volume
Installing credential helpers... 
done
Cloning into '/com.docker.devenvironments.code'...
Running .docker migration
Migration: no config.json detected
Migration: project is already configured for dev envs
building compose stack
2022/10/23 16:21:09 INFO: [core] [Channel #1] Channel created
2022/10/23 16:21:09 INFO: [core] [Channel #1] original dial target is: "unix:///run/buildkit/buildkitd.sock"
2022/10/23 16:21:09 INFO: [core] [Channel #1] parsed dial target is: {Scheme:unix Authority: Endpoint:run/buildkit/buildkitd.sock URL:{Scheme:unix Opaque: User: Host: Path:/run/buildkit/buildkitd.sock RawPath: OmitHost:false ForceQuery:false RawQuery: Fragment: RawFragment:}}
2022/10/23 16:21:09 INFO: [core] [Channel #1] Channel authority set to "localhost"
2022/10/23 16:21:09 INFO: [core] [Channel #1] Resolver state updated: {
  "Addresses": [
    {
      "Addr": "/run/buildkit/buildkitd.sock",
      "ServerName": "",
      "Attributes": {},
      "BalancerAttributes": null,
      "Type": 0,
      "Metadata": null
    }
  ],
  "ServiceConfig": null,
  "Attributes": null
} (resolver returned new addresses)
2022/10/23 16:21:09 INFO: [core] [Channel #1] Channel switches to new LB policy "pick_first"
2022/10/23 16:21:09 INFO: [core] [Channel #1 SubChannel #2] Subchannel created
2022/10/23 16:21:09 INFO: [core] [Channel #1 SubChannel #2] Subchannel Connectivity change to CONNECTING
2022/10/23 16:21:09 INFO: [core] [Channel #1 SubChannel #2] Subchannel picks a new address "/run/buildkit/buildkitd.sock" to connect
2022/10/23 16:21:09 INFO: [core] pickfirstBalancer: UpdateSubConnState: 0x14000722880, {CONNECTING <nil>}
2022/10/23 16:21:09 INFO: [core] blockingPicker: the picked transport is not ready, loop back to repick
2022/10/23 16:21:09 INFO: [core] [Channel #1] Channel Connectivity change to CONNECTING
2022/10/23 16:21:09 INFO: [core] [Channel #1 SubChannel #2] Subchannel Connectivity change to READY
2022/10/23 16:21:09 INFO: [core] pickfirstBalancer: UpdateSubConnState: 0x14000722880, {READY <nil>}
2022/10/23 16:21:09 INFO: [core] [Channel #1] Channel Connectivity change to READY
2022/10/23 16:21:09 INFO: [core] [Server #4] Server created
2022/10/23 16:21:09 INFO: [core] [Server #5] Server created
#1 [internal] load .dockerignore

```

Wait for few seconds and check the status of the Dev Environment.

## Verifying the Dev Environment status

```
docker dev ls
NAME                                   STATUS
awesome-compose-beautiful_moser        running
```

Wait for few seconds and you will see that the application is accessible via http://localhost:8000


![Image7](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/opfm0l21tsszguen8fsf.png)

You can verify Dev Environment under Docker Dashboard too.


![Image9](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k85lyiid5srhyguxyg2z.png)

## References:

- [Docker Desktop 4.13.0 Release Notes](https://docs.docker.com/desktop/release-notes/#docker-desktop-4130)
- [Docker Awesome Compose](https://github.com/docker/awesome-compose)


## Getting Help

Have a question about Docker Desktop? Search the Docker Forum Docker Desktop tag for answers, or post a question in our [Docker Community Forum](https://forums.docker.com).