Skip to content

Upgrade base of docker-sonic-mgmt to Ubuntu 24.04#24306

Merged
StormLiangMS merged 9 commits intosonic-net:masterfrom
wangxin:docker-sonic-mgmt-24
Nov 20, 2025
Merged

Upgrade base of docker-sonic-mgmt to Ubuntu 24.04#24306
StormLiangMS merged 9 commits intosonic-net:masterfrom
wangxin:docker-sonic-mgmt-24

Conversation

@wangxin
Copy link
Copy Markdown
Contributor

@wangxin wangxin commented Oct 21, 2025

Why I did it

The base image Ubuntu 20.04 of docker-sonic-mgmt is end of support now. Need to upgrade the base image and the dependent packages to address potential vulnerability issues.

DO NOT MERGE until sonic-net/sonic-mgmt#21045 is merged and cherry-picked to all current active branches.

Work item tracking
  • Microsoft ADO (number only):

How I did it

  • Upgraded base image of docker-sonic-mgmt to Ubuntu 24.04.
  • Upgraded the build environment to bookworm.
  • Removed the logic of building flag LEGACY_SONIC_MGMT_DOCKER. All the sonic-mgmt branches are using python3 now. It's not necessary to build docker-sonic-mgmt to support python2. And python2 is end of support too.
  • Version of python packages are not pinned down. This change has pros and cons.
    • Pros: Keep the docker-sonic-mgmt up to date to avoid future big version leap which could be difficult to handle.
    • Cons: Community package upgrade could have issue and cause regression.
  • Version of ansible is pinned to 11.10.0. It's because pytest-ansible does not support the latest ansible due to pytest-ansible's stdout_callback fails on Ansible 2.19 ansible/pytest-ansible#489
  • Python packages are installed to /opt/venv by following the recommendation of Ubuntu 24.04.
  • The dash-api package is reverted to install from source code. The dash-api debian package built in bookworm cannot be installed in Ubuntu 24.04 due to dependency issues.
  • Default user "ubuntu" of Ubuntu 24.04 is removed from the image to avoid potential issues. For details, please refer to Improve setup-container.sh for Ubuntu 24.04 based docker-sonic-mgmt sonic-mgmt#20761. Skipped adding regular user. With this change, the image will only have root user. The setup-container.sh tool in the sonic-mgmt repository can add regular user. Recommend to use the setup-container.sh tool to create sonic-mgmt container.
  • Improved the code for installing docker and azure-cli.
  • Remove the build dependency of the ptf debian package. It's because the ptf package is installed by python pip.

How to verify it

After the upgrade, there are some compatibility issues. The compatibility issues are fixed in sonic-net/sonic-mgmt#21045.
I am using that PR to verify that all PR test scripts can pass by using the upgraded docker-sonic-mgmt.

The fix in sonic-net/sonic-mgmt#21045 is backward compatible. Backward compatibility is verified by PR testing of sonic-net/sonic-mgmt#20851

Which release branch to backport (provide reason below if selected)

  • 202205
  • 202211
  • 202305
  • 202311
  • 202405
  • 202411
  • 202505

Tested branch (Please provide the tested image version)

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@wangxin wangxin marked this pull request as ready for review October 23, 2025 01:11
Copilot AI review requested due to automatic review settings October 23, 2025 01:11
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR upgrades the docker-sonic-mgmt base image from Ubuntu 20.04 to Ubuntu 24.04, along with updating the build environment from Bullseye to Bookworm and modernizing the Docker image configuration to address end-of-support concerns.

Key changes include:

  • Base image updated to Ubuntu 24.04 with Python packages installed in a virtual environment at /opt/venv
  • Removed support for Python 2 and the LEGACY_SONIC_MGMT_DOCKER build flag
  • Build dependencies simplified by removing PTF and LIB_SONIC_DASH_API packages, with dash-api now installed from source

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
slave.mk Removed logging of deprecated LEGACY_SONIC_MGMT_DOCKER flag
rules/docker-sonic-mgmt.mk Updated build environment to bookworm and removed PTF and dash-api dependencies
dockers/docker-sonic-mgmt/Dockerfile.j2 Upgraded base to Ubuntu 24.04, refactored package installation to use venv, modernized docker/azure-cli setup
Makefile.work Removed LEGACY_SONIC_MGMT_DOCKER flag configuration and build variable
.azure-pipelines/docker-sonic-mgmt.yml Updated pipeline to use bookworm environment and removed legacy flag
.azure-pipelines/docker-sonic-mgmt-mixed.yml Deleted entire pipeline file for mixed/legacy builds

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings October 23, 2025 01:26
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings October 23, 2025 01:28
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

ashutosh-agrawal pushed a commit to AnantKishorSharma/sonic-buildimage that referenced this pull request Nov 30, 2025
Why I did it
The base image Ubuntu 20.04 of docker-sonic-mgmt is end of support now. Need to upgrade the base image and the dependent packages to address potential vulnerability issues.

DO NOT MERGE until sonic-net/sonic-mgmt#21045 is merged and cherry-picked to all current active branches.

Work item tracking
Microsoft ADO (number only):
How I did it
Upgraded base image of docker-sonic-mgmt to Ubuntu 24.04.
Upgraded the build environment to bookworm.
Removed the logic of building flag LEGACY_SONIC_MGMT_DOCKER. All the sonic-mgmt branches are using python3 now. It's not necessary to build docker-sonic-mgmt to support python2. And python2 is end of support too.
Version of python packages are not pinned down. This change has pros and cons.
Pros: Keep the docker-sonic-mgmt up to date to avoid future big version leap which could be difficult to handle.
Cons: Community package upgrade could have issue and cause regression.
Version of ansible is pinned to 11.10.0. It's because pytest-ansible does not support the latest ansible due to pytest-ansible's stdout_callback fails on Ansible 2.19 ansible/pytest-ansible#489
Python packages are installed to /opt/venv by following the recommendation of Ubuntu 24.04.
The dash-api package is reverted to install from source code. The dash-api debian package built in bookworm cannot be installed in Ubuntu 24.04 due to dependency issues.
Default user "ubuntu" of Ubuntu 24.04 is removed from the image to avoid potential issues. For details, please refer to Improve setup-container.sh for Ubuntu 24.04 based docker-sonic-mgmt sonic-mgmt#20761. Skipped adding regular user. With this change, the image will only have root user. The setup-container.sh tool in the sonic-mgmt repository can add regular user. Recommend to use the setup-container.sh tool to create sonic-mgmt container.
Improved the code for installing docker and azure-cli.
Remove the build dependency of the ptf debian package. It's because the ptf package is installed by python pip.
How to verify it
After the upgrade, there are some compatibility issues. The compatibility issues are fixed in sonic-net/sonic-mgmt#21045.
I am using that PR to verify that all PR test scripts can pass by using the upgraded docker-sonic-mgmt.

The fix in sonic-net/sonic-mgmt#21045 is backward compatible. Backward compatibility is verified by PR testing of sonic-net/sonic-mgmt#20851
vikumarks pushed a commit to vikumarks/sonic-mgmt that referenced this pull request Dec 1, 2025
…c-net#21045)

What is the motivation for this PR?
This PR is to continue the effort made by @yutongzhang-microsoft in sonic-net#18339

The current docker-sonic-mgmt image is based on Ubuntu 20.04 which is end of support now. PR sonic-net/sonic-buildimage#24306 upgraded the base image of docker-sonic-mgmt to Ubuntu 24.04. Together, version of most packages are upgraded too. The upgrade introduced lots of compatibility issues. This PR is to fix all the compatibility issues.

All the fixes are backward compatible. The code change woks with both current and new docker-sonic-mgmt.

How did you do it?
Fix the snmp code caused by pysnmp upgrade.
Fix json dump of ansible result caused by pytest-ansible upgrade.
How did you verify/test it?
Take advantage of the current sonic-mgmt PR testing.
Verified that the code change works with new docker-sonic-mgmt in sonic-net#20851
Verified that the code change works with the current docker-sonic-mgmt in this PR.

Signed-off-by: vikumarks <vikumar7ks@gmail.com>
hdwhdw pushed a commit to hdwhdw/sonic-buildimage that referenced this pull request Dec 2, 2025
Why I did it
The base image Ubuntu 20.04 of docker-sonic-mgmt is end of support now. Need to upgrade the base image and the dependent packages to address potential vulnerability issues.

DO NOT MERGE until sonic-net/sonic-mgmt#21045 is merged and cherry-picked to all current active branches.

Work item tracking
Microsoft ADO (number only):
How I did it
Upgraded base image of docker-sonic-mgmt to Ubuntu 24.04.
Upgraded the build environment to bookworm.
Removed the logic of building flag LEGACY_SONIC_MGMT_DOCKER. All the sonic-mgmt branches are using python3 now. It's not necessary to build docker-sonic-mgmt to support python2. And python2 is end of support too.
Version of python packages are not pinned down. This change has pros and cons.
Pros: Keep the docker-sonic-mgmt up to date to avoid future big version leap which could be difficult to handle.
Cons: Community package upgrade could have issue and cause regression.
Version of ansible is pinned to 11.10.0. It's because pytest-ansible does not support the latest ansible due to pytest-ansible's stdout_callback fails on Ansible 2.19 ansible/pytest-ansible#489
Python packages are installed to /opt/venv by following the recommendation of Ubuntu 24.04.
The dash-api package is reverted to install from source code. The dash-api debian package built in bookworm cannot be installed in Ubuntu 24.04 due to dependency issues.
Default user "ubuntu" of Ubuntu 24.04 is removed from the image to avoid potential issues. For details, please refer to Improve setup-container.sh for Ubuntu 24.04 based docker-sonic-mgmt sonic-mgmt#20761. Skipped adding regular user. With this change, the image will only have root user. The setup-container.sh tool in the sonic-mgmt repository can add regular user. Recommend to use the setup-container.sh tool to create sonic-mgmt container.
Improved the code for installing docker and azure-cli.
Remove the build dependency of the ptf debian package. It's because the ptf package is installed by python pip.
How to verify it
After the upgrade, there are some compatibility issues. The compatibility issues are fixed in sonic-net/sonic-mgmt#21045.
I am using that PR to verify that all PR test scripts can pass by using the upgraded docker-sonic-mgmt.

The fix in sonic-net/sonic-mgmt#21045 is backward compatible. Backward compatibility is verified by PR testing of sonic-net/sonic-mgmt#20851
NavdhaJindal pushed a commit to NavdhaJindal/sonic-buildimage that referenced this pull request Dec 2, 2025
Why I did it
The base image Ubuntu 20.04 of docker-sonic-mgmt is end of support now. Need to upgrade the base image and the dependent packages to address potential vulnerability issues.

DO NOT MERGE until sonic-net/sonic-mgmt#21045 is merged and cherry-picked to all current active branches.

Work item tracking
Microsoft ADO (number only):
How I did it
Upgraded base image of docker-sonic-mgmt to Ubuntu 24.04.
Upgraded the build environment to bookworm.
Removed the logic of building flag LEGACY_SONIC_MGMT_DOCKER. All the sonic-mgmt branches are using python3 now. It's not necessary to build docker-sonic-mgmt to support python2. And python2 is end of support too.
Version of python packages are not pinned down. This change has pros and cons.
Pros: Keep the docker-sonic-mgmt up to date to avoid future big version leap which could be difficult to handle.
Cons: Community package upgrade could have issue and cause regression.
Version of ansible is pinned to 11.10.0. It's because pytest-ansible does not support the latest ansible due to pytest-ansible's stdout_callback fails on Ansible 2.19 ansible/pytest-ansible#489
Python packages are installed to /opt/venv by following the recommendation of Ubuntu 24.04.
The dash-api package is reverted to install from source code. The dash-api debian package built in bookworm cannot be installed in Ubuntu 24.04 due to dependency issues.
Default user "ubuntu" of Ubuntu 24.04 is removed from the image to avoid potential issues. For details, please refer to Improve setup-container.sh for Ubuntu 24.04 based docker-sonic-mgmt sonic-mgmt#20761. Skipped adding regular user. With this change, the image will only have root user. The setup-container.sh tool in the sonic-mgmt repository can add regular user. Recommend to use the setup-container.sh tool to create sonic-mgmt container.
Improved the code for installing docker and azure-cli.
Remove the build dependency of the ptf debian package. It's because the ptf package is installed by python pip.
How to verify it
After the upgrade, there are some compatibility issues. The compatibility issues are fixed in sonic-net/sonic-mgmt#21045.
I am using that PR to verify that all PR test scripts can pass by using the upgraded docker-sonic-mgmt.

The fix in sonic-net/sonic-mgmt#21045 is backward compatible. Backward compatibility is verified by PR testing of sonic-net/sonic-mgmt#20851

Signed-off-by: Navdha Jindal <navdhajindal@microsoft.com>
albertovillarreal-keys pushed a commit to albertovillarreal-keys/sonic-mgmt that referenced this pull request Dec 2, 2025
…c-net#21045)

What is the motivation for this PR?
This PR is to continue the effort made by @yutongzhang-microsoft in sonic-net#18339

The current docker-sonic-mgmt image is based on Ubuntu 20.04 which is end of support now. PR sonic-net/sonic-buildimage#24306 upgraded the base image of docker-sonic-mgmt to Ubuntu 24.04. Together, version of most packages are upgraded too. The upgrade introduced lots of compatibility issues. This PR is to fix all the compatibility issues.

All the fixes are backward compatible. The code change woks with both current and new docker-sonic-mgmt.

How did you do it?
Fix the snmp code caused by pysnmp upgrade.
Fix json dump of ansible result caused by pytest-ansible upgrade.
How did you verify/test it?
Take advantage of the current sonic-mgmt PR testing.
Verified that the code change works with new docker-sonic-mgmt in sonic-net#20851
Verified that the code change works with the current docker-sonic-mgmt in this PR.

Signed-off-by: Alberto Villarreal <alberto.villarreal@keysight.com>
@mssonicbld
Copy link
Copy Markdown
Collaborator

Cherry-pick PR to 202511: #24704

FengPan-Frank pushed a commit to FengPan-Frank/sonic-buildimage that referenced this pull request Dec 4, 2025
Why I did it
The base image Ubuntu 20.04 of docker-sonic-mgmt is end of support now. Need to upgrade the base image and the dependent packages to address potential vulnerability issues.

DO NOT MERGE until sonic-net/sonic-mgmt#21045 is merged and cherry-picked to all current active branches.

Work item tracking
Microsoft ADO (number only):
How I did it
Upgraded base image of docker-sonic-mgmt to Ubuntu 24.04.
Upgraded the build environment to bookworm.
Removed the logic of building flag LEGACY_SONIC_MGMT_DOCKER. All the sonic-mgmt branches are using python3 now. It's not necessary to build docker-sonic-mgmt to support python2. And python2 is end of support too.
Version of python packages are not pinned down. This change has pros and cons.
Pros: Keep the docker-sonic-mgmt up to date to avoid future big version leap which could be difficult to handle.
Cons: Community package upgrade could have issue and cause regression.
Version of ansible is pinned to 11.10.0. It's because pytest-ansible does not support the latest ansible due to pytest-ansible's stdout_callback fails on Ansible 2.19 ansible/pytest-ansible#489
Python packages are installed to /opt/venv by following the recommendation of Ubuntu 24.04.
The dash-api package is reverted to install from source code. The dash-api debian package built in bookworm cannot be installed in Ubuntu 24.04 due to dependency issues.
Default user "ubuntu" of Ubuntu 24.04 is removed from the image to avoid potential issues. For details, please refer to Improve setup-container.sh for Ubuntu 24.04 based docker-sonic-mgmt sonic-mgmt#20761. Skipped adding regular user. With this change, the image will only have root user. The setup-container.sh tool in the sonic-mgmt repository can add regular user. Recommend to use the setup-container.sh tool to create sonic-mgmt container.
Improved the code for installing docker and azure-cli.
Remove the build dependency of the ptf debian package. It's because the ptf package is installed by python pip.
How to verify it
After the upgrade, there are some compatibility issues. The compatibility issues are fixed in sonic-net/sonic-mgmt#21045.
I am using that PR to verify that all PR test scripts can pass by using the upgraded docker-sonic-mgmt.

The fix in sonic-net/sonic-mgmt#21045 is backward compatible. Backward compatibility is verified by PR testing of sonic-net/sonic-mgmt#20851

Signed-off-by: Feng Pan <fenpan@microsoft.com>
opcoder0 pushed a commit to opcoder0/sonic-mgmt that referenced this pull request Dec 8, 2025
…c-net#21045)

What is the motivation for this PR?
This PR is to continue the effort made by @yutongzhang-microsoft in sonic-net#18339

The current docker-sonic-mgmt image is based on Ubuntu 20.04 which is end of support now. PR sonic-net/sonic-buildimage#24306 upgraded the base image of docker-sonic-mgmt to Ubuntu 24.04. Together, version of most packages are upgraded too. The upgrade introduced lots of compatibility issues. This PR is to fix all the compatibility issues.

All the fixes are backward compatible. The code change woks with both current and new docker-sonic-mgmt.

How did you do it?
Fix the snmp code caused by pysnmp upgrade.
Fix json dump of ansible result caused by pytest-ansible upgrade.
How did you verify/test it?
Take advantage of the current sonic-mgmt PR testing.
Verified that the code change works with new docker-sonic-mgmt in sonic-net#20851
Verified that the code change works with the current docker-sonic-mgmt in this PR.

Signed-off-by: opcoder0 <110003254+opcoder0@users.noreply.github.com>
selldinesh pushed a commit to selldinesh/sonic-mgmt that referenced this pull request Dec 11, 2025
…c-net#21045)

What is the motivation for this PR?
This PR is to continue the effort made by @yutongzhang-microsoft in sonic-net#18339

The current docker-sonic-mgmt image is based on Ubuntu 20.04 which is end of support now. PR sonic-net/sonic-buildimage#24306 upgraded the base image of docker-sonic-mgmt to Ubuntu 24.04. Together, version of most packages are upgraded too. The upgrade introduced lots of compatibility issues. This PR is to fix all the compatibility issues.

All the fixes are backward compatible. The code change woks with both current and new docker-sonic-mgmt.

How did you do it?
Fix the snmp code caused by pysnmp upgrade.
Fix json dump of ansible result caused by pytest-ansible upgrade.
How did you verify/test it?
Take advantage of the current sonic-mgmt PR testing.
Verified that the code change works with new docker-sonic-mgmt in sonic-net#20851
Verified that the code change works with the current docker-sonic-mgmt in this PR.

Signed-off-by: selldinesh <dinesh.sellappan@keysight.com>
echuawu pushed a commit to echuawu/sonic-mgmt that referenced this pull request Dec 12, 2025
…c-net#21045)

What is the motivation for this PR?
This PR is to continue the effort made by @yutongzhang-microsoft in sonic-net#18339

The current docker-sonic-mgmt image is based on Ubuntu 20.04 which is end of support now. PR sonic-net/sonic-buildimage#24306 upgraded the base image of docker-sonic-mgmt to Ubuntu 24.04. Together, version of most packages are upgraded too. The upgrade introduced lots of compatibility issues. This PR is to fix all the compatibility issues.

All the fixes are backward compatible. The code change woks with both current and new docker-sonic-mgmt.

How did you do it?
Fix the snmp code caused by pysnmp upgrade.
Fix json dump of ansible result caused by pytest-ansible upgrade.
How did you verify/test it?
Take advantage of the current sonic-mgmt PR testing.
Verified that the code change works with new docker-sonic-mgmt in sonic-net#20851
Verified that the code change works with the current docker-sonic-mgmt in this PR.
@mssonicbld
Copy link
Copy Markdown
Collaborator

@wangxin cherry pick PR didn't pass PR checker. Please check!!!
#24704

1 similar comment
@mssonicbld
Copy link
Copy Markdown
Collaborator

@wangxin cherry pick PR didn't pass PR checker. Please check!!!
#24704

saravanan-nexthop pushed a commit to saravanan-nexthop/sonic-mgmt that referenced this pull request Dec 15, 2025
…c-net#21045)

What is the motivation for this PR?
This PR is to continue the effort made by @yutongzhang-microsoft in sonic-net#18339

The current docker-sonic-mgmt image is based on Ubuntu 20.04 which is end of support now. PR sonic-net/sonic-buildimage#24306 upgraded the base image of docker-sonic-mgmt to Ubuntu 24.04. Together, version of most packages are upgraded too. The upgrade introduced lots of compatibility issues. This PR is to fix all the compatibility issues.

All the fixes are backward compatible. The code change woks with both current and new docker-sonic-mgmt.

How did you do it?
Fix the snmp code caused by pysnmp upgrade.
Fix json dump of ansible result caused by pytest-ansible upgrade.
How did you verify/test it?
Take advantage of the current sonic-mgmt PR testing.
Verified that the code change works with new docker-sonic-mgmt in sonic-net#20851
Verified that the code change works with the current docker-sonic-mgmt in this PR.

Signed-off-by: Saravanan <saravanan@nexthop.ai>
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Dec 16, 2025
…c-net#21045)

What is the motivation for this PR?
This PR is to continue the effort made by @yutongzhang-microsoft in sonic-net#18339

The current docker-sonic-mgmt image is based on Ubuntu 20.04 which is end of support now. PR sonic-net/sonic-buildimage#24306 upgraded the base image of docker-sonic-mgmt to Ubuntu 24.04. Together, version of most packages are upgraded too. The upgrade introduced lots of compatibility issues. This PR is to fix all the compatibility issues.

All the fixes are backward compatible. The code change woks with both current and new docker-sonic-mgmt.

How did you do it?
Fix the snmp code caused by pysnmp upgrade.
Fix json dump of ansible result caused by pytest-ansible upgrade.
How did you verify/test it?
Take advantage of the current sonic-mgmt PR testing.
Verified that the code change works with new docker-sonic-mgmt in sonic-net#20851
Verified that the code change works with the current docker-sonic-mgmt in this PR.

Signed-off-by: Guy Shemesh <gshemesh@nvidia.com>
AharonMalkin pushed a commit to AharonMalkin/sonic-mgmt that referenced this pull request Dec 16, 2025
…c-net#21045)

What is the motivation for this PR?
This PR is to continue the effort made by @yutongzhang-microsoft in sonic-net#18339

The current docker-sonic-mgmt image is based on Ubuntu 20.04 which is end of support now. PR sonic-net/sonic-buildimage#24306 upgraded the base image of docker-sonic-mgmt to Ubuntu 24.04. Together, version of most packages are upgraded too. The upgrade introduced lots of compatibility issues. This PR is to fix all the compatibility issues.

All the fixes are backward compatible. The code change woks with both current and new docker-sonic-mgmt.

How did you do it?
Fix the snmp code caused by pysnmp upgrade.
Fix json dump of ansible result caused by pytest-ansible upgrade.
How did you verify/test it?
Take advantage of the current sonic-mgmt PR testing.
Verified that the code change works with new docker-sonic-mgmt in sonic-net#20851
Verified that the code change works with the current docker-sonic-mgmt in this PR.

Signed-off-by: Aharon Malkin <amalkin@nvidia.com>
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Dec 21, 2025
…c-net#21045)

What is the motivation for this PR?
This PR is to continue the effort made by @yutongzhang-microsoft in sonic-net#18339

The current docker-sonic-mgmt image is based on Ubuntu 20.04 which is end of support now. PR sonic-net/sonic-buildimage#24306 upgraded the base image of docker-sonic-mgmt to Ubuntu 24.04. Together, version of most packages are upgraded too. The upgrade introduced lots of compatibility issues. This PR is to fix all the compatibility issues.

All the fixes are backward compatible. The code change woks with both current and new docker-sonic-mgmt.

How did you do it?
Fix the snmp code caused by pysnmp upgrade.
Fix json dump of ansible result caused by pytest-ansible upgrade.
How did you verify/test it?
Take advantage of the current sonic-mgmt PR testing.
Verified that the code change works with new docker-sonic-mgmt in sonic-net#20851
Verified that the code change works with the current docker-sonic-mgmt in this PR.

Signed-off-by: Guy Shemesh <gshemesh@nvidia.com>
xwjiang-ms pushed a commit to xwjiang-ms/sonic-buildimage that referenced this pull request Dec 22, 2025
Why I did it
The base image Ubuntu 20.04 of docker-sonic-mgmt is end of support now. Need to upgrade the base image and the dependent packages to address potential vulnerability issues.

DO NOT MERGE until sonic-net/sonic-mgmt#21045 is merged and cherry-picked to all current active branches.

Work item tracking
Microsoft ADO (number only):
How I did it
Upgraded base image of docker-sonic-mgmt to Ubuntu 24.04.
Upgraded the build environment to bookworm.
Removed the logic of building flag LEGACY_SONIC_MGMT_DOCKER. All the sonic-mgmt branches are using python3 now. It's not necessary to build docker-sonic-mgmt to support python2. And python2 is end of support too.
Version of python packages are not pinned down. This change has pros and cons.
Pros: Keep the docker-sonic-mgmt up to date to avoid future big version leap which could be difficult to handle.
Cons: Community package upgrade could have issue and cause regression.
Version of ansible is pinned to 11.10.0. It's because pytest-ansible does not support the latest ansible due to pytest-ansible's stdout_callback fails on Ansible 2.19 ansible/pytest-ansible#489
Python packages are installed to /opt/venv by following the recommendation of Ubuntu 24.04.
The dash-api package is reverted to install from source code. The dash-api debian package built in bookworm cannot be installed in Ubuntu 24.04 due to dependency issues.
Default user "ubuntu" of Ubuntu 24.04 is removed from the image to avoid potential issues. For details, please refer to Improve setup-container.sh for Ubuntu 24.04 based docker-sonic-mgmt sonic-mgmt#20761. Skipped adding regular user. With this change, the image will only have root user. The setup-container.sh tool in the sonic-mgmt repository can add regular user. Recommend to use the setup-container.sh tool to create sonic-mgmt container.
Improved the code for installing docker and azure-cli.
Remove the build dependency of the ptf debian package. It's because the ptf package is installed by python pip.
How to verify it
After the upgrade, there are some compatibility issues. The compatibility issues are fixed in sonic-net/sonic-mgmt#21045.
I am using that PR to verify that all PR test scripts can pass by using the upgraded docker-sonic-mgmt.

The fix in sonic-net/sonic-mgmt#21045 is backward compatible. Backward compatibility is verified by PR testing of sonic-net/sonic-mgmt#20851

Signed-off-by: xiaweijiang <xiaweijiang@microsoft.com>
venu-nexthop pushed a commit to venu-nexthop/sonic-mgmt that referenced this pull request Jan 13, 2026
…c-net#21045)

What is the motivation for this PR?
This PR is to continue the effort made by @yutongzhang-microsoft in sonic-net#18339

The current docker-sonic-mgmt image is based on Ubuntu 20.04 which is end of support now. PR sonic-net/sonic-buildimage#24306 upgraded the base image of docker-sonic-mgmt to Ubuntu 24.04. Together, version of most packages are upgraded too. The upgrade introduced lots of compatibility issues. This PR is to fix all the compatibility issues.

All the fixes are backward compatible. The code change woks with both current and new docker-sonic-mgmt.

How did you do it?
Fix the snmp code caused by pysnmp upgrade.
Fix json dump of ansible result caused by pytest-ansible upgrade.
How did you verify/test it?
Take advantage of the current sonic-mgmt PR testing.
Verified that the code change works with new docker-sonic-mgmt in sonic-net#20851
Verified that the code change works with the current docker-sonic-mgmt in this PR.
yifan-nexthop pushed a commit to nexthop-ai/sonic-mgmt that referenced this pull request Jan 14, 2026
…c-net#21045)

What is the motivation for this PR?
This PR is to continue the effort made by @yutongzhang-microsoft in sonic-net#18339

The current docker-sonic-mgmt image is based on Ubuntu 20.04 which is end of support now. PR sonic-net/sonic-buildimage#24306 upgraded the base image of docker-sonic-mgmt to Ubuntu 24.04. Together, version of most packages are upgraded too. The upgrade introduced lots of compatibility issues. This PR is to fix all the compatibility issues.

All the fixes are backward compatible. The code change woks with both current and new docker-sonic-mgmt.

How did you do it?
Fix the snmp code caused by pysnmp upgrade.
Fix json dump of ansible result caused by pytest-ansible upgrade.
How did you verify/test it?
Take advantage of the current sonic-mgmt PR testing.
Verified that the code change works with new docker-sonic-mgmt in sonic-net#20851
Verified that the code change works with the current docker-sonic-mgmt in this PR.

Signed-off-by: YiFan Wang <yifan@nexthop.ai>
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Jan 26, 2026
…c-net#21045)

What is the motivation for this PR?
This PR is to continue the effort made by @yutongzhang-microsoft in sonic-net#18339

The current docker-sonic-mgmt image is based on Ubuntu 20.04 which is end of support now. PR sonic-net/sonic-buildimage#24306 upgraded the base image of docker-sonic-mgmt to Ubuntu 24.04. Together, version of most packages are upgraded too. The upgrade introduced lots of compatibility issues. This PR is to fix all the compatibility issues.

All the fixes are backward compatible. The code change woks with both current and new docker-sonic-mgmt.

How did you do it?
Fix the snmp code caused by pysnmp upgrade.
Fix json dump of ansible result caused by pytest-ansible upgrade.
How did you verify/test it?
Take advantage of the current sonic-mgmt PR testing.
Verified that the code change works with new docker-sonic-mgmt in sonic-net#20851
Verified that the code change works with the current docker-sonic-mgmt in this PR.

Signed-off-by: Guy Shemesh <gshemesh@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: docker-sonic-mgmt fails to build on master

8 participants