MSBuild is for building a project, not containers. In general you will have a build script that runs that would handle this. In a build server environment the script generally pulls down the code, sets up any build infrastructure, builds the solution(s), runs unit tests and then publishes the build and/or builds containers. MSBuild is only responsible for one of these steps.
If for some reason you really, really want to do this as part of the build then the workaround would be to create a post-build event in your project. However post build events run after a project builds, not the solution. Therefore you'd have to ensure it was the last project to build. Then you can run any command line tools you need to. But, again, this is not recommended. Furthermore post build events run in VS as well so you probably don't want to waste the time building a container while debugging.
Finally note that VS has built in support for containers. While I haven't used it myself I suspect VS can help generate the scripts you need.