You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/docker-mcp-toolkit/4-run-migration.md
+46-32Lines changed: 46 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,9 +15,11 @@ cd docker-blog-arm-migration
15
15
code .
16
16
```
17
17
18
-
Make sure the MCP_DOCKER server is running in VS Code (check**Extensions** > **MCP_DOCKER** > **Start Server** if needed).
18
+
Make sure the MCP_DOCKER server is running in VS Code ( Use**Extensions** > **MCP_DOCKER** > **Start Server** if needed).
19
19
20
-
## Give GitHub Copilot migration instructions
20
+
This allows GitHub Copilot to invoke the configured MCP servers through the MCP Gateway.
21
+
22
+
## Provide migration instructions to GitHub Copilot
21
23
22
24
Open GitHub Copilot Chat in VS Code and paste the following prompt:
23
25
@@ -48,22 +50,24 @@ After completing the migration:
48
50
- Include performance predictions and cost savings in the PR description
49
51
- List all tools used and validation steps needed
50
52
```
53
+
This prompt instructs Copilot to use structured MCP tools rather than relying purely on generated suggestions.
51
54
52
-
## Watch the migration execute
55
+
## Observe the migration workflow
53
56
54
-
GitHub Copilot orchestrates the migration through four phases using the Docker MCP Toolkit.
57
+
Copilot now orchestrates the migration using the configured MCP servers. The workflow typically proceeds in several phases.
55
58
56
-
### Phase 1: Image analysis
59
+
### Phase 1: Container Image analysis
57
60
58
-
Copilot uses the `skopeo`tool from the Arm MCP Server to analyze the base image:
61
+
Copilot invokes `check_image` or `skopeo` from the Arm MCP Server:
59
62
60
63
```text
61
64
Checking centos:6 for arm64 support...
62
65
```
63
66
64
-
The tool reports that `centos:6` has no `linux/arm64` build available. This is the first blocker identified. Copilot determines that the base image must be replaced.
67
+
The tool reports that `centos:6` has no `linux/arm64` build available. Copilot proposes replacing the base image with a modern multi-architecture alternative.
68
+
This step ensures the container can build and run on Arm hardware before addressing source-level changes.
65
69
66
-
### Phase 2: Code scanning
70
+
### Phase 2: Source Code scanning
67
71
68
72
Copilot runs the `migrate_ease_scan` tool with the C++ scanner:
69
73
@@ -77,17 +81,18 @@ The scan detects:
77
81
- The `-mavx2` compiler flag in the Dockerfile.
78
82
- The x86-specific header `<immintrin.h>`.
79
83
80
-
Each issue includes the file location, line number, and specific code requiring modification.
84
+
Each finding includes file locations and recommended actions. This structured scan avoids manually searching through the codebase.
81
85
82
-
### Phase 3: Knowledge base lookup and code conversion
86
+
### Phase 3: Knowledge base lookup and refactoring code
83
87
84
88
For each x86 intrinsic found, Copilot queries the Arm MCP Server knowledge base:
85
89
86
90
```text
87
91
Searching knowledge base for: AVX2 to NEON intrinsic conversion
88
92
```
89
93
90
-
The knowledge base returns Arm documentation with the conversions:
94
+
The Arm MCP knowledge base provides documented guidance on intrinsic mapping and architecture considerations.
95
+
Example mappings:
91
96
92
97
| x86 AVX2 Intrinsic | Arm NEON Equivalent |
93
98
|---------------------|---------------------|
@@ -96,37 +101,46 @@ The knowledge base returns Arm documentation with the conversions:
96
101
|`_mm256_add_pd()`| Two `vaddq_f64()` operations |
97
102
|`_mm256_mul_pd()`| Two `vmulq_f64()` operations |
98
103
99
-
The knowledge base also explains that AVX2 uses 256-bit vectors processing 4 doubles at once, while NEON uses 128-bit vectors processing 2 doubles. Loop strides must be adjusted accordingly.
100
-
101
-
Copilot rewrites the code using this information:
102
-
103
-
- Replaces `<immintrin.h>` with `<arm_neon.h>` inside `#ifdef __aarch64__` guards.
104
-
- Converts the AVX2 loop structure (stride 4) to NEON (stride 2).
105
-
- Rewrites the horizontal reduction for NEON.
106
-
- Updates the Dockerfile to use `ubuntu:22.04` with `TARGETARCH` for multi-arch builds.
107
-
- Changes the compiler flag from `-mavx2` to `-march=armv8-a+simd`.
108
-
109
-
### Phase 4: Create the pull request
110
-
111
-
Copilot uses the GitHub MCP Server to create a pull request with:
112
-
113
-
- All code changes (source files and Dockerfile).
114
-
- A detailed description of what was changed and why.
115
-
- Performance predictions for Arm.
116
-
- A list of all MCP tools used during the migration.
104
+
Because AVX2 operates on 256-bit vectors (four doubles) and NEON operates on 128-bit vectors (two doubles), Copilot adjusts:
105
+
- Loop stride
106
+
- Accumulation logic
107
+
- Horizontal reduction pattern
108
+
-
109
+
The refactoring typically includes:
110
+
- Guarding architecture-specific code with #ifdef __aarch64__
111
+
- Replacing <immintrin.h> with <arm_neon.h> where appropriate
112
+
- Updating compiler flags (for example replacing -mavx2)
113
+
- Selecting an Arm-compatible base image such as ubuntu:22.04
114
+
- Supporting multi-architecture builds using TARGETARCH
115
+
116
+
All proposed changes should be reviewed before merging.
117
+
118
+
### Phase 4: Pull request creation
119
+
120
+
Once modifications are complete, Copilot invokes the GitHub MCP Server to:
121
+
- Create a branch
122
+
- Commit changes
123
+
- Open a pull request
124
+
125
+
The PR typically includes:
126
+
- Updated Dockerfile
127
+
- Refactored source files
128
+
- A description of the changes
129
+
- A summary of MCP tools used
130
+
- Suggested validation steps for Arm hardware
117
131
118
132
You can see an example PR at [github.com/JoeStech/docker-blog-arm-migration/pull/1](https://github.com/JoeStech/docker-blog-arm-migration/pull/1).
119
133
120
134
## Summary of changes
121
135
122
-
The migration produces these key changes:
136
+
After migration, you should see:
123
137
124
-
**Dockerfile**:
138
+
**Dockerfile updates**:
125
139
- Replaced `centos:6` with `ubuntu:22.04`.
126
140
- Added `TARGETARCH` for multi-architecture builds.
127
141
- Changed `-mavx2` to `-march=armv8-a+simd` for Arm builds.
128
142
129
-
**Source code**:
143
+
**Source code updates**:
130
144
- Added `#ifdef __aarch64__` architecture guards.
131
145
- Replaced all `_mm256_*` AVX2 intrinsics with NEON equivalents (`vld1q_f64`, `vaddq_f64`, `vmulq_f64`).
132
146
- Adjusted loop strides from 4 (AVX2) to 2 (NEON).
0 commit comments