Sign inSign up

openeuler/protobuf

Sponsored OSS

By openeuler

•Updated about 5 hours ago

Image
0

583

openeuler/protobuf repository overview

⁠Quick reference

⁠protobuf | openEuler

Current protobuf docker images are built on the openEuler⁠. This repository is free to use and exempted from per-user rate limits.

Protocol Buffers (a.k.a., protobuf) are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data.

Learn more on Protocol Buffers Documentation⁠.

The tag of each protobuf docker image is consist of the version of protobuf and the version of basic image. The details are as follows

TagCurrentlyArchitectures
36.2-oe2403sp4⁠protobuf 36.2 on openEuler 24.03-LTS-SP4amd64, arm64
36.0-rc2-oe2403sp4⁠protobuf 36.0-rc2 on openEuler 24.03-LTS-SP4amd64, arm64

⁠Usage

In this usage, users can select the corresponding {Tag} based on their requirements.

  • Pull the openeuler/protobuf image from docker

    docker pull openeuler/protobuf:{Tag}
    
  • Check the installed protoc version

    docker run --rm openeuler/protobuf:{Tag} protoc --version
    
  • Compile a .proto file

    Create a person.proto file in the current directory:

    syntax = "proto3";
    
    message Person {
      string name = 1;
      int32 id = 2;
      string email = 3;
    }
    

    Generate C++ source code from the proto file with the protoc compiler:

    docker run --rm -v "$(pwd)":/work -w /work openeuler/protobuf:{Tag} \
        protoc --cpp_out=. person.proto
    

    The generated files person.pb.h and person.pb.cc are written to the current directory.

  • Link against libprotobuf from CMake

    From the 36.2 tag on, the image also ships libprotobuf and its CMake package (protobuf-config.cmake), so C++ projects can resolve it with find_package:

    cmake_minimum_required(VERSION 3.16)
    project(demo CXX)
    
    find_package(protobuf CONFIG REQUIRED)
    
    add_executable(demo main.cc person.pb.cc)
    target_link_libraries(demo PRIVATE protobuf::libprotobuf)
    

    The headers and libraries are installed under /usr/local, which is part of the default CMake search path, and the library directory is registered with the dynamic linker.

  • Start a long-running container for exploration

    docker run -d --name my-protobuf openeuler/protobuf:{Tag} sleep infinity
    
  • View the container logs

    docker logs -f my-protobuf
    
  • To get an interactive shell

    docker exec -it my-protobuf bash
    

⁠Question and answering

If you have any questions or want to use some special features, please submit an issue or a pull request on openeuler-docker-images⁠.

Tag summary

Content type

Image

Digest

sha256:ab481fc32…

Size

199.2 MB

Last updated

about 5 hours ago

docker pull openeuler/protobuf

This week's pulls

Pulls:

48

Oct 19 to Oct 25