Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build and develop Docker development environment on Mac

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article focuses on "how to build a development Docker development environment on Mac". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to build a Docker development environment on Mac.

The goal here is not to use Docker's Container to build an application development environment, but to build a development environment for developing Docker, including debug to Docker itself, to track the running of Docker.

However, in fact, the development environment of Docker itself can be a Container of Docker. So you must install a Docker first.

1. Install Docker

The official documentation for Mac,Docker is well documented. Http://docs.docker.com/installation/mac/

According to the documentation, you can use kitematic to complete Docker in one step, and you can download it from https://kitematic.com/. (Docker has recently acquired kitematic, and kitematic may become a management tool for Docker in the future.)

The installation process is almost completed in one step, and no configuration is required. Cool tool.

2. (optional) remove unnecessary things, including existing Docker Image and Container

This step is optional. Is whether you want to make the development environment cleaner.

(1) View container

Docker ps-a

(2) stop and delete Container

Docker stop [container name]

Docker rm [container name]

(3) View image

Docker images

(4) Delete image

Docker rmi-f $(docker images-Q-a-f dangling=true)

3. Fork Docker source code, build branch

(I won't elaborate on this here.)

4. Open a Docker CLI,build Docker

This is a must, must adapt to the console of the docker environment, can not use ordinary linux console.

Because kitematic is used, there is no need to use boot2docker here.

Start ketematic and click the fish-like icon 'open terminal to use docker command line'' in the lower corner.

Enter the Docker source directory and run:

Docker build-t docker-test.

If you use'. 'directly here, you can automatically find the Dockerfile in the source directory. Docker-test is the name image.

This step will be slow because you have to download a lot of things. (you may not be able to download it. You can use the Hong Kong special line.)

After the build is successful, you can view it using docker images.

5. Using docker-test image to establish Docker Development Environment Container

Open a new Docker CLI and enter the docker source directory

Docker run-privileged-rm-name docker-test-ti-v `pwd`: / go/ src / github. Com / docker / docker docker-test / bin / bash

6. Compile docke

Open a new Docker Cli and enter the docker source directory

Make BINDDIR=. Binary

7. Start docker in container

Go back to the Docker container window in step 5

(1) copy the docker executable file compiled in step 6. (because the command in step 5 uses the parameter-v setting, the host and container share the docker source directory.)

Cp bundles/1.5.0-dev/binary/docker / usr/bin

(2) run docker daemon program: docker-dD

8. Verify the Docker program of the Docker development environment Container

(1) Open a Docker cli (you can use Docker cli in step 6) and enter the development environment Container:

Docker exec-it container_name bash

(2) run in development environment Container:

Docker run hello-world

At this point, I believe you have a deeper understanding of "how to build a development Docker development environment on Mac". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report