The livestock sector contributes to agricultural development, poverty reduction, and food security globally. The digitization of the supply chain entails cost savings and improved flexibility, both of which are essential ingredients for boosting resilience in the world food chains. Recently, microservice architectures are becoming popular alternatives to existing software development paradigms, particularly for developing complex and distributed applications. Microservices and supply chains are built upon the enabling technologies of the Fourth Industrial Revolution (Industry 4.0), including the Internet of Things (IoT). However, integrating supply chain infrastructure with IoT and microservices can create a new set of security threats that can defeat this objective without adequate awareness and countermeasures. This study presents an overview of current and potential threats to data-sharing systems in the smart dairy and livestock industries. This paper presents a multi-layered microservices architecture, which emphasizes the importance of communications across layers and multiple bridgeheads. Afterwards, it describes the security aspects of microservices architecture, the threats to data-sharing systems, and the link between attacks and security. Finally, this paper identifies areas that need further study to improve security requirements for IoT microservices in the supply chain and data sharing systems.